diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-27 01:54:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-27 01:54:32 -0500 |
commit | 1c7c2cdec3a6b2873439096983794a550d7ff65b (patch) | |
tree | 10ea67846407e9882d50e95a9db675140dd423eb | |
parent | 0444fa78751260b38f0db3418e001bf86593f05f (diff) | |
parent | 7267c3377443322588cddaf457cf106839a60463 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (63 commits)
ide: remove REQ_TYPE_ATA_CMD
ide: switch ide_cmd_ioctl() to use REQ_TYPE_ATA_TASKFILE requests
ide: switch set_xfer_rate() to use REQ_TYPE_ATA_TASKFILE requests
ide: fix final status check in drive_cmd_intr()
ide: check BUSY and ERROR status bits before reading data in drive_cmd_intr()
ide: don't enable local IRQs for PIO-in in driver_cmd_intr() (take 2)
ide: convert "empty" REQ_TYPE_ATA_CMD requests to use REQ_TYPE_ATA_TASKFILE
ide: initialize rq->cmd_type in ide_init_drive_cmd() callers
ide: use wait_drive_not_busy() in drive_cmd_intr() (take 2)
ide: kill DATA_READY define
ide: task_end_request() fix
ide: use rq->nr_sectors in task_end_request()
ide: remove needless ->cursg clearing from task_end_request()
ide: set IDE_TFLAG_IN_* flags before queuing/executing command
ide-tape: fix handling of non-special requests in ->end_request method
ide: fix final status check in task_in_intr()
ide: clear HOB bit for REQ_TYPE_ATA_CMD requests in ide_end_drive_cmd()
ide: fix ->io_32bit race in ide_taskfile_ioctl()
cmd64x: remove /proc/ide/cmd64x
ide: remove broken disk byte-swapping support
...
65 files changed, 999 insertions, 1446 deletions
diff --git a/Documentation/ide.txt b/Documentation/ide.txt index 1d50f23a5cab..94e2e3b9e77f 100644 --- a/Documentation/ide.txt +++ b/Documentation/ide.txt | |||
@@ -30,7 +30,7 @@ | |||
30 | *** | 30 | *** |
31 | *** The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT* | 31 | *** The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT* |
32 | *** automatically detected by Linux. For safe, reliable operation with such | 32 | *** automatically detected by Linux. For safe, reliable operation with such |
33 | *** interfaces, one *MUST* use the "ide0=cmd640_vlb" kernel option. | 33 | *** interfaces, one *MUST* use the "cmd640.probe_vlb" kernel option. |
34 | *** | 34 | *** |
35 | *** Use of the "serialize" option is no longer necessary. | 35 | *** Use of the "serialize" option is no longer necessary. |
36 | 36 | ||
@@ -244,10 +244,6 @@ Summary of ide driver parameters for kernel command line | |||
244 | 244 | ||
245 | "hdx=nodma" : disallow DMA | 245 | "hdx=nodma" : disallow DMA |
246 | 246 | ||
247 | "hdx=swapdata" : when the drive is a disk, byte swap all data | ||
248 | |||
249 | "hdx=bswap" : same as above.......... | ||
250 | |||
251 | "hdx=scsi" : the return of the ide-scsi flag, this is useful for | 247 | "hdx=scsi" : the return of the ide-scsi flag, this is useful for |
252 | allowing ide-floppy, ide-tape, and ide-cdrom|writers | 248 | allowing ide-floppy, ide-tape, and ide-cdrom|writers |
253 | to use ide-scsi emulation on a device specific option. | 249 | to use ide-scsi emulation on a device specific option. |
@@ -292,9 +288,6 @@ The following are valid ONLY on ide0, which usually corresponds | |||
292 | to the first ATA interface found on the particular host, and the defaults for | 288 | to the first ATA interface found on the particular host, and the defaults for |
293 | the base,ctl ports must not be altered. | 289 | the base,ctl ports must not be altered. |
294 | 290 | ||
295 | "ide0=cmd640_vlb" : *REQUIRED* for VLB cards with the CMD640 chip | ||
296 | (not for PCI -- automatically detected) | ||
297 | |||
298 | "ide=doubler" : probe/support IDE doublers on Amiga | 291 | "ide=doubler" : probe/support IDE doublers on Amiga |
299 | 292 | ||
300 | There may be more options than shown -- use the source, Luke! | 293 | There may be more options than shown -- use the source, Luke! |
@@ -310,6 +303,10 @@ i.e. to enable probing for ALI M14xx chipsets (ali14xx host driver) use: | |||
310 | * "probe" module parameter when ali14xx driver is compiled as module | 303 | * "probe" module parameter when ali14xx driver is compiled as module |
311 | ("modprobe ali14xx probe") | 304 | ("modprobe ali14xx probe") |
312 | 305 | ||
306 | Also for legacy CMD640 host driver (cmd640) you need to use "probe_vlb" | ||
307 | kernel paremeter to enable probing for VLB version of the chipset (PCI ones | ||
308 | are detected automatically). | ||
309 | |||
313 | ================================================================================ | 310 | ================================================================================ |
314 | 311 | ||
315 | IDE ATAPI streaming tape driver | 312 | IDE ATAPI streaming tape driver |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index ee01e273a537..64df55e20ab5 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -325,7 +325,7 @@ config BLK_DEV_PLATFORM | |||
325 | If unsure, say N. | 325 | If unsure, say N. |
326 | 326 | ||
327 | config BLK_DEV_CMD640 | 327 | config BLK_DEV_CMD640 |
328 | bool "CMD640 chipset bugfix/support" | 328 | tristate "CMD640 chipset bugfix/support" |
329 | depends on X86 | 329 | depends on X86 |
330 | ---help--- | 330 | ---help--- |
331 | The CMD-Technologies CMD640 IDE chip is used on many common 486 and | 331 | The CMD-Technologies CMD640 IDE chip is used on many common 486 and |
@@ -359,9 +359,8 @@ config BLK_DEV_CMD640_ENHANCED | |||
359 | Otherwise say N. | 359 | Otherwise say N. |
360 | 360 | ||
361 | config BLK_DEV_IDEPNP | 361 | config BLK_DEV_IDEPNP |
362 | bool "PNP EIDE support" | 362 | tristate "PNP EIDE support" |
363 | depends on PNP | 363 | depends on PNP |
364 | select IDE_GENERIC | ||
365 | help | 364 | help |
366 | If you have a PnP (Plug and Play) compatible EIDE card and | 365 | If you have a PnP (Plug and Play) compatible EIDE card and |
367 | would like the kernel to automatically detect and activate | 366 | would like the kernel to automatically detect and activate |
@@ -375,7 +374,19 @@ config BLK_DEV_IDEPCI | |||
375 | bool | 374 | bool |
376 | 375 | ||
377 | config IDEPCI_PCIBUS_ORDER | 376 | config IDEPCI_PCIBUS_ORDER |
378 | def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI | 377 | bool "Probe IDE PCI devices in the PCI bus order (DEPRECATED)" |
378 | depends on BLK_DEV_IDE=y && BLK_DEV_IDEPCI | ||
379 | default y | ||
380 | help | ||
381 | Probe IDE PCI devices in the order in which they appear on the | ||
382 | PCI bus (i.e. 00:1f.1 PCI device before 02:01.0 PCI device) | ||
383 | instead of the order in which IDE PCI host drivers are loaded. | ||
384 | |||
385 | Please note that this method of assuring stable naming of | ||
386 | IDE devices is unreliable and use other means for achieving | ||
387 | it (i.e. udev). | ||
388 | |||
389 | If in doubt, say N. | ||
379 | 390 | ||
380 | # TODO: split it on per host driver config options (or module parameters) | 391 | # TODO: split it on per host driver config options (or module parameters) |
381 | config BLK_DEV_OFFBOARD | 392 | config BLK_DEV_OFFBOARD |
@@ -789,7 +800,7 @@ config BLK_DEV_CELLEB | |||
789 | endif | 800 | endif |
790 | 801 | ||
791 | config BLK_DEV_IDE_PMAC | 802 | config BLK_DEV_IDE_PMAC |
792 | bool "Builtin PowerMac IDE support" | 803 | tristate "Builtin PowerMac IDE support" |
793 | depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y | 804 | depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y |
794 | help | 805 | help |
795 | This driver provides support for the built-in IDE controller on | 806 | This driver provides support for the built-in IDE controller on |
@@ -843,8 +854,9 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ | |||
843 | depends on BLK_DEV_IDE_AU1XXX | 854 | depends on BLK_DEV_IDE_AU1XXX |
844 | 855 | ||
845 | config IDE_ARM | 856 | config IDE_ARM |
846 | def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) | 857 | tristate "ARM IDE support" |
847 | select IDE_GENERIC | 858 | depends on ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) |
859 | default y | ||
848 | 860 | ||
849 | config BLK_DEV_IDE_ICSIDE | 861 | config BLK_DEV_IDE_ICSIDE |
850 | tristate "ICS IDE interface support" | 862 | tristate "ICS IDE interface support" |
@@ -876,10 +888,9 @@ config BLK_DEV_IDE_BAST | |||
876 | Simtec BAST or the Thorcom VR1000 | 888 | Simtec BAST or the Thorcom VR1000 |
877 | 889 | ||
878 | config ETRAX_IDE | 890 | config ETRAX_IDE |
879 | bool "ETRAX IDE support" | 891 | tristate "ETRAX IDE support" |
880 | depends on CRIS && BROKEN | 892 | depends on CRIS && BROKEN |
881 | select BLK_DEV_IDEDMA | 893 | select BLK_DEV_IDEDMA |
882 | select IDE_GENERIC | ||
883 | help | 894 | help |
884 | Enables the ETRAX IDE driver. | 895 | Enables the ETRAX IDE driver. |
885 | 896 | ||
@@ -911,17 +922,15 @@ config ETRAX_IDE_G27_RESET | |||
911 | endchoice | 922 | endchoice |
912 | 923 | ||
913 | config IDE_H8300 | 924 | config IDE_H8300 |
914 | bool "H8300 IDE support" | 925 | tristate "H8300 IDE support" |
915 | depends on H8300 | 926 | depends on H8300 |
916 | select IDE_GENERIC | ||
917 | default y | 927 | default y |
918 | help | 928 | help |
919 | Enables the H8300 IDE driver. | 929 | Enables the H8300 IDE driver. |
920 | 930 | ||
921 | config BLK_DEV_GAYLE | 931 | config BLK_DEV_GAYLE |
922 | bool "Amiga Gayle IDE interface support" | 932 | tristate "Amiga Gayle IDE interface support" |
923 | depends on AMIGA | 933 | depends on AMIGA |
924 | select IDE_GENERIC | ||
925 | help | 934 | help |
926 | This is the IDE driver for the Amiga Gayle IDE interface. It supports | 935 | This is the IDE driver for the Amiga Gayle IDE interface. It supports |
927 | both the `A1200 style' and `A4000 style' of the Gayle IDE interface, | 936 | both the `A1200 style' and `A4000 style' of the Gayle IDE interface, |
@@ -951,9 +960,8 @@ config BLK_DEV_IDEDOUBLER | |||
951 | runtime using the "ide=doubler" kernel boot parameter. | 960 | runtime using the "ide=doubler" kernel boot parameter. |
952 | 961 | ||
953 | config BLK_DEV_BUDDHA | 962 | config BLK_DEV_BUDDHA |
954 | bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" | 963 | tristate "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" |
955 | depends on ZORRO && EXPERIMENTAL | 964 | depends on ZORRO && EXPERIMENTAL |
956 | select IDE_GENERIC | ||
957 | help | 965 | help |
958 | This is the IDE driver for the IDE interfaces on the Buddha, | 966 | This is the IDE driver for the IDE interfaces on the Buddha, |
959 | Catweasel and X-Surf expansion boards. It supports up to two interfaces | 967 | Catweasel and X-Surf expansion boards. It supports up to two interfaces |
@@ -964,9 +972,8 @@ config BLK_DEV_BUDDHA | |||
964 | to one of its IDE interfaces. | 972 | to one of its IDE interfaces. |
965 | 973 | ||
966 | config BLK_DEV_FALCON_IDE | 974 | config BLK_DEV_FALCON_IDE |
967 | bool "Falcon IDE interface support" | 975 | tristate "Falcon IDE interface support" |
968 | depends on ATARI | 976 | depends on ATARI |
969 | select IDE_GENERIC | ||
970 | help | 977 | help |
971 | This is the IDE driver for the builtin IDE interface on the Atari | 978 | This is the IDE driver for the builtin IDE interface on the Atari |
972 | Falcon. Say Y if you have a Falcon and want to use IDE devices (hard | 979 | Falcon. Say Y if you have a Falcon and want to use IDE devices (hard |
@@ -974,9 +981,8 @@ config BLK_DEV_FALCON_IDE | |||
974 | interface. | 981 | interface. |
975 | 982 | ||
976 | config BLK_DEV_MAC_IDE | 983 | config BLK_DEV_MAC_IDE |
977 | bool "Macintosh Quadra/Powerbook IDE interface support" | 984 | tristate "Macintosh Quadra/Powerbook IDE interface support" |
978 | depends on MAC | 985 | depends on MAC |
979 | select IDE_GENERIC | ||
980 | help | 986 | help |
981 | This is the IDE driver for the builtin IDE interface on some m68k | 987 | This is the IDE driver for the builtin IDE interface on some m68k |
982 | Macintosh models. It supports both the `Quadra style' (used in | 988 | Macintosh models. It supports both the `Quadra style' (used in |
@@ -988,18 +994,16 @@ config BLK_DEV_MAC_IDE | |||
988 | builtin IDE interface. | 994 | builtin IDE interface. |
989 | 995 | ||
990 | config BLK_DEV_Q40IDE | 996 | config BLK_DEV_Q40IDE |
991 | bool "Q40/Q60 IDE interface support" | 997 | tristate "Q40/Q60 IDE interface support" |
992 | depends on Q40 | 998 | depends on Q40 |
993 | select IDE_GENERIC | ||
994 | help | 999 | help |
995 | Enable the on-board IDE controller in the Q40/Q60. This should | 1000 | Enable the on-board IDE controller in the Q40/Q60. This should |
996 | normally be on; disable it only if you are running a custom hard | 1001 | normally be on; disable it only if you are running a custom hard |
997 | drive subsystem through an expansion card. | 1002 | drive subsystem through an expansion card. |
998 | 1003 | ||
999 | config BLK_DEV_MPC8xx_IDE | 1004 | config BLK_DEV_MPC8xx_IDE |
1000 | bool "MPC8xx IDE support" | 1005 | tristate "MPC8xx IDE support" |
1001 | depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE | 1006 | depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE |
1002 | select IDE_GENERIC | ||
1003 | help | 1007 | help |
1004 | This option provides support for IDE on Motorola MPC8xx Systems. | 1008 | This option provides support for IDE on Motorola MPC8xx Systems. |
1005 | Please see 'Type of MPC8xx IDE interface' for details. | 1009 | Please see 'Type of MPC8xx IDE interface' for details. |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index b181fc672057..0d2da89d15cf 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
@@ -7,41 +7,37 @@ | |||
7 | # Note : at this point, these files are compiled on all systems. | 7 | # Note : at this point, these files are compiled on all systems. |
8 | # In the future, some of these should be built conditionally. | 8 | # In the future, some of these should be built conditionally. |
9 | # | 9 | # |
10 | # First come modules that register themselves with the core | 10 | # link order is important here |
11 | 11 | ||
12 | EXTRA_CFLAGS += -Idrivers/ide | 12 | EXTRA_CFLAGS += -Idrivers/ide |
13 | 13 | ||
14 | obj-$(CONFIG_BLK_DEV_IDE) += pci/ | ||
15 | |||
16 | ide-core-y += ide.o ide-io.o ide-iops.o ide-lib.o ide-probe.o ide-taskfile.o | 14 | ide-core-y += ide.o ide-io.o ide-iops.o ide-lib.o ide-probe.o ide-taskfile.o |
17 | 15 | ||
18 | ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o | 16 | # core IDE code |
19 | |||
20 | # Core IDE code - must come before legacy | ||
21 | ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o | 17 | ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o |
22 | ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o | 18 | ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o |
23 | ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o | 19 | ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o |
24 | ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o | ||
25 | ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o | 20 | ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o |
26 | 21 | ||
27 | # built-in only drivers from arm/ | 22 | obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o |
28 | ide-core-$(CONFIG_IDE_ARM) += arm/ide_arm.o | ||
29 | 23 | ||
30 | # built-in only drivers from legacy/ | 24 | ifeq ($(CONFIG_IDE_ARM), y) |
31 | ide-core-$(CONFIG_BLK_DEV_BUDDHA) += legacy/buddha.o | 25 | ide-arm-core-y += arm/ide_arm.o |
32 | ide-core-$(CONFIG_BLK_DEV_FALCON_IDE) += legacy/falconide.o | 26 | obj-y += ide-arm-core.o |
33 | ide-core-$(CONFIG_BLK_DEV_GAYLE) += legacy/gayle.o | 27 | endif |
34 | ide-core-$(CONFIG_BLK_DEV_MAC_IDE) += legacy/macide.o | ||
35 | ide-core-$(CONFIG_BLK_DEV_Q40IDE) += legacy/q40ide.o | ||
36 | 28 | ||
37 | # built-in only drivers from ppc/ | 29 | obj-$(CONFIG_BLK_DEV_IDE) += legacy/ pci/ |
38 | ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o | ||
39 | ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o | ||
40 | 30 | ||
41 | # built-in only drivers from h8300/ | 31 | obj-$(CONFIG_IDEPCI_PCIBUS_ORDER) += ide-scan-pci.o |
42 | ide-core-$(CONFIG_IDE_H8300) += h8300/ide-h8300.o | ||
43 | 32 | ||
44 | obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o | 33 | ifeq ($(CONFIG_BLK_DEV_CMD640), y) |
34 | cmd640-core-y += pci/cmd640.o | ||
35 | obj-y += cmd640-core.o | ||
36 | endif | ||
37 | |||
38 | obj-$(CONFIG_BLK_DEV_IDE) += cris/ ppc/ | ||
39 | obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o | ||
40 | obj-$(CONFIG_IDE_H8300) += h8300/ | ||
45 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o | 41 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o |
46 | 42 | ||
47 | obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o | 43 | obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o |
@@ -49,6 +45,20 @@ obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd.o | |||
49 | obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o | 45 | obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o |
50 | obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o | 46 | obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o |
51 | 47 | ||
52 | obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ mips/ | 48 | ifeq ($(CONFIG_BLK_DEV_IDECS), y) |
53 | obj-$(CONFIG_BLK_DEV_HD) += legacy/ | 49 | ide-cs-core-y += legacy/ide-cs.o |
54 | obj-$(CONFIG_ETRAX_IDE) += cris/ | 50 | obj-y += ide-cs-core.o |
51 | endif | ||
52 | |||
53 | ifeq ($(CONFIG_BLK_DEV_PLATFORM), y) | ||
54 | ide-platform-core-y += legacy/ide_platform.o | ||
55 | obj-y += ide-platform-core.o | ||
56 | endif | ||
57 | |||
58 | obj-$(CONFIG_BLK_DEV_IDE) += arm/ mips/ | ||
59 | |||
60 | # old hd driver must be last | ||
61 | ifeq ($(CONFIG_BLK_DEV_HD), y) | ||
62 | hd-core-y += legacy/hd.o | ||
63 | obj-y += hd-core.o | ||
64 | endif | ||
diff --git a/drivers/ide/arm/Makefile b/drivers/ide/arm/Makefile index 6a78f0755f26..5f63ad216862 100644 --- a/drivers/ide/arm/Makefile +++ b/drivers/ide/arm/Makefile | |||
@@ -3,4 +3,8 @@ obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o | |||
3 | obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o | 3 | obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o |
4 | obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o | 4 | obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o |
5 | 5 | ||
6 | ifeq ($(CONFIG_IDE_ARM), m) | ||
7 | obj-m += ide_arm.o | ||
8 | endif | ||
9 | |||
6 | EXTRA_CFLAGS := -Idrivers/ide | 10 | EXTRA_CFLAGS := -Idrivers/ide |
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c index 48db6167bb90..45bf9c825f2b 100644 --- a/drivers/ide/arm/bast-ide.c +++ b/drivers/ide/arm/bast-ide.c | |||
@@ -45,7 +45,7 @@ bastide_register(unsigned int base, unsigned int aux, int irq, | |||
45 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); | 45 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); |
46 | hw.irq = irq; | 46 | hw.irq = irq; |
47 | 47 | ||
48 | ide_register_hw(&hw, NULL, 0, hwif); | 48 | ide_register_hw(&hw, NULL, hwif); |
49 | 49 | ||
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 673402f4a295..8a5c7205b77c 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -287,26 +287,10 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode) | |||
287 | ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data); | 287 | ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data); |
288 | } | 288 | } |
289 | 289 | ||
290 | static void icside_dma_host_off(ide_drive_t *drive) | 290 | static void icside_dma_host_set(ide_drive_t *drive, int on) |
291 | { | 291 | { |
292 | } | 292 | } |
293 | 293 | ||
294 | static void icside_dma_off_quietly(ide_drive_t *drive) | ||
295 | { | ||
296 | drive->using_dma = 0; | ||
297 | } | ||
298 | |||
299 | static void icside_dma_host_on(ide_drive_t *drive) | ||
300 | { | ||
301 | } | ||
302 | |||
303 | static int icside_dma_on(ide_drive_t *drive) | ||
304 | { | ||
305 | drive->using_dma = 1; | ||
306 | |||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static int icside_dma_end(ide_drive_t *drive) | 294 | static int icside_dma_end(ide_drive_t *drive) |
311 | { | 295 | { |
312 | ide_hwif_t *hwif = HWIF(drive); | 296 | ide_hwif_t *hwif = HWIF(drive); |
@@ -422,10 +406,7 @@ static void icside_dma_init(ide_hwif_t *hwif) | |||
422 | hwif->dmatable_dma = 0; | 406 | hwif->dmatable_dma = 0; |
423 | hwif->set_dma_mode = icside_set_dma_mode; | 407 | hwif->set_dma_mode = icside_set_dma_mode; |
424 | 408 | ||
425 | hwif->dma_host_off = icside_dma_host_off; | 409 | hwif->dma_host_set = icside_dma_host_set; |
426 | hwif->dma_off_quietly = icside_dma_off_quietly; | ||
427 | hwif->dma_host_on = icside_dma_host_on; | ||
428 | hwif->ide_dma_on = icside_dma_on; | ||
429 | hwif->dma_setup = icside_dma_setup; | 410 | hwif->dma_setup = icside_dma_setup; |
430 | hwif->dma_exec_cmd = icside_dma_exec_cmd; | 411 | hwif->dma_exec_cmd = icside_dma_exec_cmd; |
431 | hwif->dma_start = icside_dma_start; | 412 | hwif->dma_start = icside_dma_start; |
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c index 8957cbadf5c2..60f2497542c0 100644 --- a/drivers/ide/arm/ide_arm.c +++ b/drivers/ide/arm/ide_arm.c | |||
@@ -24,12 +24,25 @@ | |||
24 | # define IDE_ARM_IRQ IRQ_HARDDISK | 24 | # define IDE_ARM_IRQ IRQ_HARDDISK |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | void __init ide_arm_init(void) | 27 | static int __init ide_arm_init(void) |
28 | { | 28 | { |
29 | ide_hwif_t *hwif; | ||
29 | hw_regs_t hw; | 30 | hw_regs_t hw; |
31 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
30 | 32 | ||
31 | memset(&hw, 0, sizeof(hw)); | 33 | memset(&hw, 0, sizeof(hw)); |
32 | ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); | 34 | ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); |
33 | hw.irq = IDE_ARM_IRQ; | 35 | hw.irq = IDE_ARM_IRQ; |
34 | ide_register_hw(&hw, NULL, 1, NULL); | 36 | |
37 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); | ||
38 | if (hwif) { | ||
39 | ide_init_port_hw(hwif, &hw); | ||
40 | idx[0] = hwif->index; | ||
41 | |||
42 | ide_device_add(idx); | ||
43 | } | ||
44 | |||
45 | return 0; | ||
35 | } | 46 | } |
47 | |||
48 | module_init(ide_arm_init); | ||
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index 0775a3afef48..e6b56d1d48f4 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c | |||
@@ -13,26 +13,18 @@ | |||
13 | 13 | ||
14 | #include <asm/ecard.h> | 14 | #include <asm/ecard.h> |
15 | 15 | ||
16 | static ide_hwif_t * | 16 | static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base, |
17 | rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq) | 17 | void __iomem *ctrl, unsigned int sz, int irq) |
18 | { | 18 | { |
19 | unsigned long port = (unsigned long)base; | 19 | unsigned long port = (unsigned long)base; |
20 | ide_hwif_t *hwif = ide_find_port(port); | ||
21 | int i; | 20 | int i; |
22 | 21 | ||
23 | if (hwif == NULL) | ||
24 | goto out; | ||
25 | |||
26 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { | 22 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { |
27 | hwif->io_ports[i] = port; | 23 | hw->io_ports[i] = port; |
28 | port += sz; | 24 | port += sz; |
29 | } | 25 | } |
30 | hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; | 26 | hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; |
31 | hwif->irq = irq; | 27 | hw->irq = irq; |
32 | hwif->mmio = 1; | ||
33 | default_hwif_mmiops(hwif); | ||
34 | out: | ||
35 | return hwif; | ||
36 | } | 28 | } |
37 | 29 | ||
38 | static int __devinit | 30 | static int __devinit |
@@ -42,6 +34,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
42 | void __iomem *base; | 34 | void __iomem *base; |
43 | int ret; | 35 | int ret; |
44 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 36 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
37 | hw_regs_t hw; | ||
45 | 38 | ||
46 | ret = ecard_request_resources(ec); | 39 | ret = ecard_request_resources(ec); |
47 | if (ret) | 40 | if (ret) |
@@ -53,11 +46,17 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
53 | goto release; | 46 | goto release; |
54 | } | 47 | } |
55 | 48 | ||
56 | hwif = rapide_locate_hwif(base, base + 0x818, 1 << 6, ec->irq); | 49 | hwif = ide_find_port((unsigned long)base); |
57 | if (hwif) { | 50 | if (hwif) { |
58 | hwif->hwif_data = base; | 51 | memset(&hw, 0, sizeof(hw)); |
59 | hwif->gendev.parent = &ec->dev; | 52 | rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq); |
60 | hwif->noprobe = 0; | 53 | hw.chipset = ide_generic; |
54 | hw.dev = &ec->dev; | ||
55 | |||
56 | ide_init_port_hw(hwif, &hw); | ||
57 | |||
58 | hwif->mmio = 1; | ||
59 | default_hwif_mmiops(hwif); | ||
61 | 60 | ||
62 | idx[0] = hwif->index; | 61 | idx[0] = hwif->index; |
63 | 62 | ||
diff --git a/drivers/ide/cris/Makefile b/drivers/ide/cris/Makefile index 6176e8d6b2e6..20b95960531f 100644 --- a/drivers/ide/cris/Makefile +++ b/drivers/ide/cris/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | EXTRA_CFLAGS += -Idrivers/ide | 1 | EXTRA_CFLAGS += -Idrivers/ide |
2 | 2 | ||
3 | obj-y += ide-cris.o | 3 | obj-$(CONFIG_IDE_ETRAX) += ide-cris.o |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 325e608d9e62..8c3294c4d23e 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -673,9 +673,8 @@ static void cris_ide_input_data (ide_drive_t *drive, void *, unsigned int); | |||
673 | static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int); | 673 | static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int); |
674 | static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int); | 674 | static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int); |
675 | static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int); | 675 | static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int); |
676 | static int cris_dma_on (ide_drive_t *drive); | ||
677 | 676 | ||
678 | static void cris_dma_off(ide_drive_t *drive) | 677 | static void cris_dma_host_set(ide_drive_t *drive, int on) |
679 | { | 678 | { |
680 | } | 679 | } |
681 | 680 | ||
@@ -755,13 +754,11 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
755 | cris_ide_set_speed(TYPE_DMA, 0, strobe, hold); | 754 | cris_ide_set_speed(TYPE_DMA, 0, strobe, hold); |
756 | } | 755 | } |
757 | 756 | ||
758 | void __init | 757 | static int __init init_e100_ide(void) |
759 | init_e100_ide (void) | ||
760 | { | 758 | { |
761 | hw_regs_t hw; | 759 | hw_regs_t hw; |
762 | int ide_offsets[IDE_NR_PORTS]; | 760 | int ide_offsets[IDE_NR_PORTS], h, i; |
763 | int h; | 761 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
764 | int i; | ||
765 | 762 | ||
766 | printk("ide: ETRAX FS built-in ATA DMA controller\n"); | 763 | printk("ide: ETRAX FS built-in ATA DMA controller\n"); |
767 | 764 | ||
@@ -778,9 +775,11 @@ init_e100_ide (void) | |||
778 | ide_offsets, | 775 | ide_offsets, |
779 | 0, 0, cris_ide_ack_intr, | 776 | 0, 0, cris_ide_ack_intr, |
780 | ide_default_irq(0)); | 777 | ide_default_irq(0)); |
781 | ide_register_hw(&hw, NULL, 1, &hwif); | 778 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
782 | if (hwif == NULL) | 779 | if (hwif == NULL) |
783 | continue; | 780 | continue; |
781 | ide_init_port_data(hwif, hwif->index); | ||
782 | ide_init_port_hw(hwif, &hw); | ||
784 | hwif->mmio = 1; | 783 | hwif->mmio = 1; |
785 | hwif->chipset = ide_etrax100; | 784 | hwif->chipset = ide_etrax100; |
786 | hwif->set_pio_mode = &cris_set_pio_mode; | 785 | hwif->set_pio_mode = &cris_set_pio_mode; |
@@ -789,6 +788,7 @@ init_e100_ide (void) | |||
789 | hwif->ata_output_data = &cris_ide_output_data; | 788 | hwif->ata_output_data = &cris_ide_output_data; |
790 | hwif->atapi_input_bytes = &cris_atapi_input_bytes; | 789 | hwif->atapi_input_bytes = &cris_atapi_input_bytes; |
791 | hwif->atapi_output_bytes = &cris_atapi_output_bytes; | 790 | hwif->atapi_output_bytes = &cris_atapi_output_bytes; |
791 | hwif->dma_host_set = &cris_dma_host_set; | ||
792 | hwif->ide_dma_end = &cris_dma_end; | 792 | hwif->ide_dma_end = &cris_dma_end; |
793 | hwif->dma_setup = &cris_dma_setup; | 793 | hwif->dma_setup = &cris_dma_setup; |
794 | hwif->dma_exec_cmd = &cris_dma_exec_cmd; | 794 | hwif->dma_exec_cmd = &cris_dma_exec_cmd; |
@@ -799,9 +799,6 @@ init_e100_ide (void) | |||
799 | hwif->OUTBSYNC = &cris_ide_outbsync; | 799 | hwif->OUTBSYNC = &cris_ide_outbsync; |
800 | hwif->INB = &cris_ide_inb; | 800 | hwif->INB = &cris_ide_inb; |
801 | hwif->INW = &cris_ide_inw; | 801 | hwif->INW = &cris_ide_inw; |
802 | hwif->dma_host_off = &cris_dma_off; | ||
803 | hwif->dma_host_on = &cris_dma_on; | ||
804 | hwif->dma_off_quietly = &cris_dma_off; | ||
805 | hwif->cbl = ATA_CBL_PATA40; | 802 | hwif->cbl = ATA_CBL_PATA40; |
806 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 803 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
807 | hwif->pio_mask = ATA_PIO4, | 804 | hwif->pio_mask = ATA_PIO4, |
@@ -809,6 +806,8 @@ init_e100_ide (void) | |||
809 | hwif->drives[1].autotune = 1; | 806 | hwif->drives[1].autotune = 1; |
810 | hwif->ultra_mask = cris_ultra_mask; | 807 | hwif->ultra_mask = cris_ultra_mask; |
811 | hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */ | 808 | hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */ |
809 | |||
810 | idx[h] = hwif->index; | ||
812 | } | 811 | } |
813 | 812 | ||
814 | /* Reset pulse */ | 813 | /* Reset pulse */ |
@@ -821,14 +820,12 @@ init_e100_ide (void) | |||
821 | cris_ide_set_speed(TYPE_PIO, ATA_PIO4_SETUP, ATA_PIO4_STROBE, ATA_PIO4_HOLD); | 820 | cris_ide_set_speed(TYPE_PIO, ATA_PIO4_SETUP, ATA_PIO4_STROBE, ATA_PIO4_HOLD); |
822 | cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD); | 821 | cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD); |
823 | cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0); | 822 | cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0); |
824 | } | ||
825 | 823 | ||
826 | static int cris_dma_on (ide_drive_t *drive) | 824 | ide_device_add(idx); |
827 | { | 825 | |
828 | return 0; | 826 | return 0; |
829 | } | 827 | } |
830 | 828 | ||
831 | |||
832 | static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16))); | 829 | static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16))); |
833 | 830 | ||
834 | /* | 831 | /* |
@@ -1060,3 +1057,5 @@ static void cris_dma_start(ide_drive_t *drive) | |||
1060 | LED_DISK_READ(1); | 1057 | LED_DISK_READ(1); |
1061 | } | 1058 | } |
1062 | } | 1059 | } |
1060 | |||
1061 | module_init(init_e100_ide); | ||
diff --git a/drivers/ide/h8300/Makefile b/drivers/ide/h8300/Makefile new file mode 100644 index 000000000000..5eba16f423f4 --- /dev/null +++ b/drivers/ide/h8300/Makefile | |||
@@ -0,0 +1,2 @@ | |||
1 | |||
2 | obj-$(CONFIG_IDE_H8300) += ide-h8300.o | ||
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c index 4a49b5c59acb..4f6d0191cf6c 100644 --- a/drivers/ide/h8300/ide-h8300.c +++ b/drivers/ide/h8300/ide-h8300.c | |||
@@ -84,11 +84,12 @@ static inline void hwif_setup(ide_hwif_t *hwif) | |||
84 | hwif->INSL = NULL; | 84 | hwif->INSL = NULL; |
85 | } | 85 | } |
86 | 86 | ||
87 | void __init h8300_ide_init(void) | 87 | static int __init h8300_ide_init(void) |
88 | { | 88 | { |
89 | hw_regs_t hw; | 89 | hw_regs_t hw; |
90 | ide_hwif_t *hwif; | 90 | ide_hwif_t *hwif; |
91 | int idx; | 91 | int index; |
92 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
92 | 93 | ||
93 | if (!request_region(CONFIG_H8300_IDE_BASE, H8300_IDE_GAP*8, "ide-h8300")) | 94 | if (!request_region(CONFIG_H8300_IDE_BASE, H8300_IDE_GAP*8, "ide-h8300")) |
94 | goto out_busy; | 95 | goto out_busy; |
@@ -100,16 +101,28 @@ void __init h8300_ide_init(void) | |||
100 | hw_setup(&hw); | 101 | hw_setup(&hw); |
101 | 102 | ||
102 | /* register if */ | 103 | /* register if */ |
103 | idx = ide_register_hw(&hw, NULL, 1, &hwif); | 104 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
104 | if (idx == -1) { | 105 | if (hwif == NULL) { |
105 | printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); | 106 | printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); |
106 | return; | 107 | return -ENOENT; |
107 | } | 108 | } |
108 | 109 | ||
110 | index = hwif->index; | ||
111 | ide_init_port_data(hwif, index); | ||
112 | ide_init_port_hw(hwif, &hw); | ||
109 | hwif_setup(hwif); | 113 | hwif_setup(hwif); |
110 | printk(KERN_INFO "ide%d: H8/300 generic IDE interface\n", idx); | 114 | printk(KERN_INFO "ide%d: H8/300 generic IDE interface\n", index); |
111 | return; | 115 | |
116 | idx[0] = index; | ||
117 | |||
118 | ide_device_add(idx); | ||
119 | |||
120 | return 0; | ||
112 | 121 | ||
113 | out_busy: | 122 | out_busy: |
114 | printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n"); | 123 | printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n"); |
124 | |||
125 | return -EBUSY; | ||
115 | } | 126 | } |
127 | |||
128 | module_init(h8300_ide_init); | ||
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index e0bb0cfa7bdd..e888fc35b27c 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -386,7 +386,7 @@ static int taskfile_load_raw(ide_drive_t *drive, | |||
386 | 386 | ||
387 | /* convert gtf to IDE Taskfile */ | 387 | /* convert gtf to IDE Taskfile */ |
388 | memcpy(&args.tf_array[7], >f->tfa, 7); | 388 | memcpy(&args.tf_array[7], >f->tfa, 7); |
389 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 389 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
390 | 390 | ||
391 | if (ide_noacpitfs) { | 391 | if (ide_noacpitfs) { |
392 | DEBPRINT("_GTF execution disabled\n"); | 392 | DEBPRINT("_GTF execution disabled\n"); |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index d8fdd865dea9..717e114ced52 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -201,7 +201,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
201 | 201 | ||
202 | memset(&task, 0, sizeof(task)); | 202 | memset(&task, 0, sizeof(task)); |
203 | task.tf_flags = IDE_TFLAG_NO_SELECT_MASK; /* FIXME? */ | 203 | task.tf_flags = IDE_TFLAG_NO_SELECT_MASK; /* FIXME? */ |
204 | task.tf_flags |= (IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE); | 204 | task.tf_flags |= (IDE_TFLAG_TF | IDE_TFLAG_DEVICE); |
205 | 205 | ||
206 | if (drive->select.b.lba) { | 206 | if (drive->select.b.lba) { |
207 | if (lba48) { | 207 | if (lba48) { |
@@ -219,13 +219,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
219 | tf->lbal = (u8) block; | 219 | tf->lbal = (u8) block; |
220 | tf->lbam = (u8)(block >> 8); | 220 | tf->lbam = (u8)(block >> 8); |
221 | tf->lbah = (u8)(block >> 16); | 221 | tf->lbah = (u8)(block >> 16); |
222 | #ifdef DEBUG | 222 | |
223 | printk("%s: 0x%02x%02x 0x%02x%02x%02x%02x%02x%02x\n", | 223 | task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
224 | drive->name, tf->hob_nsect, tf->nsect, | ||
225 | tf->hob_lbah, tf->hob_lbam, tf->hob_lbal, | ||
226 | tf->lbah, tf->lbam, tf->lbal); | ||
227 | #endif | ||
228 | task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); | ||
229 | } else { | 224 | } else { |
230 | tf->nsect = nsectors & 0xff; | 225 | tf->nsect = nsectors & 0xff; |
231 | tf->lbal = block; | 226 | tf->lbal = block; |
@@ -319,9 +314,9 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) | |||
319 | else | 314 | else |
320 | tf->command = WIN_READ_NATIVE_MAX; | 315 | tf->command = WIN_READ_NATIVE_MAX; |
321 | tf->device = ATA_LBA; | 316 | tf->device = ATA_LBA; |
322 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 317 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
323 | if (lba48) | 318 | if (lba48) |
324 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); | 319 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
325 | /* submit command request */ | 320 | /* submit command request */ |
326 | ide_no_data_taskfile(drive, &args); | 321 | ide_no_data_taskfile(drive, &args); |
327 | 322 | ||
@@ -358,9 +353,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | |||
358 | tf->command = WIN_SET_MAX; | 353 | tf->command = WIN_SET_MAX; |
359 | } | 354 | } |
360 | tf->device |= ATA_LBA; | 355 | tf->device |= ATA_LBA; |
361 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 356 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
362 | if (lba48) | 357 | if (lba48) |
363 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); | 358 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
364 | /* submit command request */ | 359 | /* submit command request */ |
365 | ide_no_data_taskfile(drive, &args); | 360 | ide_no_data_taskfile(drive, &args); |
366 | /* if OK, compute maximum address value */ | 361 | /* if OK, compute maximum address value */ |
@@ -500,7 +495,7 @@ static int smart_enable(ide_drive_t *drive) | |||
500 | tf->lbam = SMART_LCYL_PASS; | 495 | tf->lbam = SMART_LCYL_PASS; |
501 | tf->lbah = SMART_HCYL_PASS; | 496 | tf->lbah = SMART_HCYL_PASS; |
502 | tf->command = WIN_SMART; | 497 | tf->command = WIN_SMART; |
503 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 498 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
504 | return ide_no_data_taskfile(drive, &args); | 499 | return ide_no_data_taskfile(drive, &args); |
505 | } | 500 | } |
506 | 501 | ||
@@ -515,7 +510,7 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) | |||
515 | tf->lbam = SMART_LCYL_PASS; | 510 | tf->lbam = SMART_LCYL_PASS; |
516 | tf->lbah = SMART_HCYL_PASS; | 511 | tf->lbah = SMART_HCYL_PASS; |
517 | tf->command = WIN_SMART; | 512 | tf->command = WIN_SMART; |
518 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 513 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
519 | args.data_phase = TASKFILE_IN; | 514 | args.data_phase = TASKFILE_IN; |
520 | (void) smart_enable(drive); | 515 | (void) smart_enable(drive); |
521 | return ide_raw_taskfile(drive, &args, buf, 1); | 516 | return ide_raw_taskfile(drive, &args, buf, 1); |
@@ -625,8 +620,10 @@ static int set_multcount(ide_drive_t *drive, int arg) | |||
625 | 620 | ||
626 | if (drive->special.b.set_multmode) | 621 | if (drive->special.b.set_multmode) |
627 | return -EBUSY; | 622 | return -EBUSY; |
623 | |||
628 | ide_init_drive_cmd (&rq); | 624 | ide_init_drive_cmd (&rq); |
629 | rq.cmd_type = REQ_TYPE_ATA_CMD; | 625 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; |
626 | |||
630 | drive->mult_req = arg; | 627 | drive->mult_req = arg; |
631 | drive->special.b.set_multmode = 1; | 628 | drive->special.b.set_multmode = 1; |
632 | (void) ide_do_drive_cmd (drive, &rq, ide_wait); | 629 | (void) ide_do_drive_cmd (drive, &rq, ide_wait); |
@@ -694,7 +691,7 @@ static int write_cache(ide_drive_t *drive, int arg) | |||
694 | args.tf.feature = arg ? | 691 | args.tf.feature = arg ? |
695 | SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; | 692 | SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; |
696 | args.tf.command = WIN_SETFEATURES; | 693 | args.tf.command = WIN_SETFEATURES; |
697 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 694 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
698 | err = ide_no_data_taskfile(drive, &args); | 695 | err = ide_no_data_taskfile(drive, &args); |
699 | if (err == 0) | 696 | if (err == 0) |
700 | drive->wcache = arg; | 697 | drive->wcache = arg; |
@@ -714,7 +711,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) | |||
714 | args.tf.command = WIN_FLUSH_CACHE_EXT; | 711 | args.tf.command = WIN_FLUSH_CACHE_EXT; |
715 | else | 712 | else |
716 | args.tf.command = WIN_FLUSH_CACHE; | 713 | args.tf.command = WIN_FLUSH_CACHE; |
717 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 714 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
718 | return ide_no_data_taskfile(drive, &args); | 715 | return ide_no_data_taskfile(drive, &args); |
719 | } | 716 | } |
720 | 717 | ||
@@ -729,7 +726,7 @@ static int set_acoustic (ide_drive_t *drive, int arg) | |||
729 | args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; | 726 | args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; |
730 | args.tf.nsect = arg; | 727 | args.tf.nsect = arg; |
731 | args.tf.command = WIN_SETFEATURES; | 728 | args.tf.command = WIN_SETFEATURES; |
732 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 729 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
733 | ide_no_data_taskfile(drive, &args); | 730 | ide_no_data_taskfile(drive, &args); |
734 | drive->acoustic = arg; | 731 | drive->acoustic = arg; |
735 | return 0; | 732 | return 0; |
@@ -766,7 +763,6 @@ static void idedisk_add_settings(ide_drive_t *drive) | |||
766 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL); | 763 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL); |
767 | ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL); | 764 | ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL); |
768 | ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, &drive->addressing, set_lba_addressing); | 765 | ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, &drive->addressing, set_lba_addressing); |
769 | ide_add_setting(drive, "bswap", SETTING_READ, TYPE_BYTE, 0, 1, 1, 1, &drive->bswap, NULL); | ||
770 | ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, id->max_multsect, 1, 1, &drive->mult_count, set_multcount); | 766 | ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, id->max_multsect, 1, 1, &drive->mult_count, set_multcount); |
771 | ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr); | 767 | ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr); |
772 | ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, &drive->lun, NULL); | 768 | ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, &drive->lun, NULL); |
@@ -975,6 +971,17 @@ static ide_driver_t idedisk_driver = { | |||
975 | #endif | 971 | #endif |
976 | }; | 972 | }; |
977 | 973 | ||
974 | static int idedisk_set_doorlock(ide_drive_t *drive, int on) | ||
975 | { | ||
976 | ide_task_t task; | ||
977 | |||
978 | memset(&task, 0, sizeof(task)); | ||
979 | task.tf.command = on ? WIN_DOORLOCK : WIN_DOORUNLOCK; | ||
980 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | ||
981 | |||
982 | return ide_no_data_taskfile(drive, &task); | ||
983 | } | ||
984 | |||
978 | static int idedisk_open(struct inode *inode, struct file *filp) | 985 | static int idedisk_open(struct inode *inode, struct file *filp) |
979 | { | 986 | { |
980 | struct gendisk *disk = inode->i_bdev->bd_disk; | 987 | struct gendisk *disk = inode->i_bdev->bd_disk; |
@@ -989,17 +996,13 @@ static int idedisk_open(struct inode *inode, struct file *filp) | |||
989 | idkp->openers++; | 996 | idkp->openers++; |
990 | 997 | ||
991 | if (drive->removable && idkp->openers == 1) { | 998 | if (drive->removable && idkp->openers == 1) { |
992 | ide_task_t args; | ||
993 | memset(&args, 0, sizeof(ide_task_t)); | ||
994 | args.tf.command = WIN_DOORLOCK; | ||
995 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
996 | check_disk_change(inode->i_bdev); | 999 | check_disk_change(inode->i_bdev); |
997 | /* | 1000 | /* |
998 | * Ignore the return code from door_lock, | 1001 | * Ignore the return code from door_lock, |
999 | * since the open() has already succeeded, | 1002 | * since the open() has already succeeded, |
1000 | * and the door_lock is irrelevant at this point. | 1003 | * and the door_lock is irrelevant at this point. |
1001 | */ | 1004 | */ |
1002 | if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) | 1005 | if (drive->doorlocking && idedisk_set_doorlock(drive, 1)) |
1003 | drive->doorlocking = 0; | 1006 | drive->doorlocking = 0; |
1004 | } | 1007 | } |
1005 | return 0; | 1008 | return 0; |
@@ -1015,11 +1018,7 @@ static int idedisk_release(struct inode *inode, struct file *filp) | |||
1015 | ide_cacheflush_p(drive); | 1018 | ide_cacheflush_p(drive); |
1016 | 1019 | ||
1017 | if (drive->removable && idkp->openers == 1) { | 1020 | if (drive->removable && idkp->openers == 1) { |
1018 | ide_task_t args; | 1021 | if (drive->doorlocking && idedisk_set_doorlock(drive, 0)) |
1019 | memset(&args, 0, sizeof(ide_task_t)); | ||
1020 | args.tf.command = WIN_DOORUNLOCK; | ||
1021 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
1022 | if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) | ||
1023 | drive->doorlocking = 0; | 1022 | drive->doorlocking = 0; |
1024 | } | 1023 | } |
1025 | 1024 | ||
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 18c78ad2b31e..5bf32038dc43 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -153,13 +153,7 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive) | |||
153 | if (!dma_stat) { | 153 | if (!dma_stat) { |
154 | struct request *rq = HWGROUP(drive)->rq; | 154 | struct request *rq = HWGROUP(drive)->rq; |
155 | 155 | ||
156 | if (rq->rq_disk) { | 156 | task_end_request(drive, rq, stat); |
157 | ide_driver_t *drv; | ||
158 | |||
159 | drv = *(ide_driver_t **)rq->rq_disk->private_data; | ||
160 | drv->end_request(drive, 1, rq->nr_sectors); | ||
161 | } else | ||
162 | ide_end_request(drive, 1, rq->nr_sectors); | ||
163 | return ide_stopped; | 157 | return ide_stopped; |
164 | } | 158 | } |
165 | printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n", | 159 | printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n", |
@@ -408,23 +402,29 @@ static int dma_timer_expiry (ide_drive_t *drive) | |||
408 | } | 402 | } |
409 | 403 | ||
410 | /** | 404 | /** |
411 | * ide_dma_host_off - Generic DMA kill | 405 | * ide_dma_host_set - Enable/disable DMA on a host |
412 | * @drive: drive to control | 406 | * @drive: drive to control |
413 | * | 407 | * |
414 | * Perform the generic IDE controller DMA off operation. This | 408 | * Enable/disable DMA on an IDE controller following generic |
415 | * works for most IDE bus mastering controllers | 409 | * bus-mastering IDE controller behaviour. |
416 | */ | 410 | */ |
417 | 411 | ||
418 | void ide_dma_host_off(ide_drive_t *drive) | 412 | void ide_dma_host_set(ide_drive_t *drive, int on) |
419 | { | 413 | { |
420 | ide_hwif_t *hwif = HWIF(drive); | 414 | ide_hwif_t *hwif = HWIF(drive); |
421 | u8 unit = (drive->select.b.unit & 0x01); | 415 | u8 unit = (drive->select.b.unit & 0x01); |
422 | u8 dma_stat = hwif->INB(hwif->dma_status); | 416 | u8 dma_stat = hwif->INB(hwif->dma_status); |
423 | 417 | ||
424 | hwif->OUTB((dma_stat & ~(1<<(5+unit))), hwif->dma_status); | 418 | if (on) |
419 | dma_stat |= (1 << (5 + unit)); | ||
420 | else | ||
421 | dma_stat &= ~(1 << (5 + unit)); | ||
422 | |||
423 | hwif->OUTB(dma_stat, hwif->dma_status); | ||
425 | } | 424 | } |
426 | 425 | ||
427 | EXPORT_SYMBOL(ide_dma_host_off); | 426 | EXPORT_SYMBOL_GPL(ide_dma_host_set); |
427 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ | ||
428 | 428 | ||
429 | /** | 429 | /** |
430 | * ide_dma_off_quietly - Generic DMA kill | 430 | * ide_dma_off_quietly - Generic DMA kill |
@@ -438,11 +438,10 @@ void ide_dma_off_quietly(ide_drive_t *drive) | |||
438 | drive->using_dma = 0; | 438 | drive->using_dma = 0; |
439 | ide_toggle_bounce(drive, 0); | 439 | ide_toggle_bounce(drive, 0); |
440 | 440 | ||
441 | drive->hwif->dma_host_off(drive); | 441 | drive->hwif->dma_host_set(drive, 0); |
442 | } | 442 | } |
443 | 443 | ||
444 | EXPORT_SYMBOL(ide_dma_off_quietly); | 444 | EXPORT_SYMBOL(ide_dma_off_quietly); |
445 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ | ||
446 | 445 | ||
447 | /** | 446 | /** |
448 | * ide_dma_off - disable DMA on a device | 447 | * ide_dma_off - disable DMA on a device |
@@ -455,52 +454,29 @@ EXPORT_SYMBOL(ide_dma_off_quietly); | |||
455 | void ide_dma_off(ide_drive_t *drive) | 454 | void ide_dma_off(ide_drive_t *drive) |
456 | { | 455 | { |
457 | printk(KERN_INFO "%s: DMA disabled\n", drive->name); | 456 | printk(KERN_INFO "%s: DMA disabled\n", drive->name); |
458 | drive->hwif->dma_off_quietly(drive); | 457 | ide_dma_off_quietly(drive); |
459 | } | 458 | } |
460 | 459 | ||
461 | EXPORT_SYMBOL(ide_dma_off); | 460 | EXPORT_SYMBOL(ide_dma_off); |
462 | 461 | ||
463 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | ||
464 | /** | ||
465 | * ide_dma_host_on - Enable DMA on a host | ||
466 | * @drive: drive to enable for DMA | ||
467 | * | ||
468 | * Enable DMA on an IDE controller following generic bus mastering | ||
469 | * IDE controller behaviour | ||
470 | */ | ||
471 | |||
472 | void ide_dma_host_on(ide_drive_t *drive) | ||
473 | { | ||
474 | if (drive->using_dma) { | ||
475 | ide_hwif_t *hwif = HWIF(drive); | ||
476 | u8 unit = (drive->select.b.unit & 0x01); | ||
477 | u8 dma_stat = hwif->INB(hwif->dma_status); | ||
478 | |||
479 | hwif->OUTB((dma_stat|(1<<(5+unit))), hwif->dma_status); | ||
480 | } | ||
481 | } | ||
482 | |||
483 | EXPORT_SYMBOL(ide_dma_host_on); | ||
484 | |||
485 | /** | 462 | /** |
486 | * __ide_dma_on - Enable DMA on a device | 463 | * ide_dma_on - Enable DMA on a device |
487 | * @drive: drive to enable DMA on | 464 | * @drive: drive to enable DMA on |
488 | * | 465 | * |
489 | * Enable IDE DMA for a device on this IDE controller. | 466 | * Enable IDE DMA for a device on this IDE controller. |
490 | */ | 467 | */ |
491 | 468 | ||
492 | int __ide_dma_on (ide_drive_t *drive) | 469 | void ide_dma_on(ide_drive_t *drive) |
493 | { | 470 | { |
494 | drive->using_dma = 1; | 471 | drive->using_dma = 1; |
495 | ide_toggle_bounce(drive, 1); | 472 | ide_toggle_bounce(drive, 1); |
496 | 473 | ||
497 | drive->hwif->dma_host_on(drive); | 474 | drive->hwif->dma_host_set(drive, 1); |
498 | |||
499 | return 0; | ||
500 | } | 475 | } |
501 | 476 | ||
502 | EXPORT_SYMBOL(__ide_dma_on); | 477 | EXPORT_SYMBOL(ide_dma_on); |
503 | 478 | ||
479 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | ||
504 | /** | 480 | /** |
505 | * ide_dma_setup - begin a DMA phase | 481 | * ide_dma_setup - begin a DMA phase |
506 | * @drive: target device | 482 | * @drive: target device |
@@ -755,6 +731,7 @@ EXPORT_SYMBOL_GPL(ide_find_dma_mode); | |||
755 | 731 | ||
756 | static int ide_tune_dma(ide_drive_t *drive) | 732 | static int ide_tune_dma(ide_drive_t *drive) |
757 | { | 733 | { |
734 | ide_hwif_t *hwif = drive->hwif; | ||
758 | u8 speed; | 735 | u8 speed; |
759 | 736 | ||
760 | if (noautodma || drive->nodma || (drive->id->capability & 1) == 0) | 737 | if (noautodma || drive->nodma || (drive->id->capability & 1) == 0) |
@@ -767,15 +744,21 @@ static int ide_tune_dma(ide_drive_t *drive) | |||
767 | if (ide_id_dma_bug(drive)) | 744 | if (ide_id_dma_bug(drive)) |
768 | return 0; | 745 | return 0; |
769 | 746 | ||
770 | if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA) | 747 | if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA) |
771 | return config_drive_for_dma(drive); | 748 | return config_drive_for_dma(drive); |
772 | 749 | ||
773 | speed = ide_max_dma_mode(drive); | 750 | speed = ide_max_dma_mode(drive); |
774 | 751 | ||
775 | if (!speed) | 752 | if (!speed) { |
776 | return 0; | 753 | /* is this really correct/needed? */ |
754 | if ((hwif->host_flags & IDE_HFLAG_CY82C693) && | ||
755 | ide_dma_good_drive(drive)) | ||
756 | return 1; | ||
757 | else | ||
758 | return 0; | ||
759 | } | ||
777 | 760 | ||
778 | if (drive->hwif->host_flags & IDE_HFLAG_NO_SET_MODE) | 761 | if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) |
779 | return 0; | 762 | return 0; |
780 | 763 | ||
781 | if (ide_set_dma_mode(drive, speed)) | 764 | if (ide_set_dma_mode(drive, speed)) |
@@ -820,7 +803,6 @@ err_out: | |||
820 | 803 | ||
821 | int ide_set_dma(ide_drive_t *drive) | 804 | int ide_set_dma(ide_drive_t *drive) |
822 | { | 805 | { |
823 | ide_hwif_t *hwif = drive->hwif; | ||
824 | int rc; | 806 | int rc; |
825 | 807 | ||
826 | /* | 808 | /* |
@@ -829,13 +811,15 @@ int ide_set_dma(ide_drive_t *drive) | |||
829 | * things, if not checked and cleared. | 811 | * things, if not checked and cleared. |
830 | * PARANOIA!!! | 812 | * PARANOIA!!! |
831 | */ | 813 | */ |
832 | hwif->dma_off_quietly(drive); | 814 | ide_dma_off_quietly(drive); |
833 | 815 | ||
834 | rc = ide_dma_check(drive); | 816 | rc = ide_dma_check(drive); |
835 | if (rc) | 817 | if (rc) |
836 | return rc; | 818 | return rc; |
837 | 819 | ||
838 | return hwif->ide_dma_on(drive); | 820 | ide_dma_on(drive); |
821 | |||
822 | return 0; | ||
839 | } | 823 | } |
840 | 824 | ||
841 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 825 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
@@ -972,14 +956,8 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports) | |||
972 | if (!(hwif->dma_prdtable)) | 956 | if (!(hwif->dma_prdtable)) |
973 | hwif->dma_prdtable = (hwif->dma_base + 4); | 957 | hwif->dma_prdtable = (hwif->dma_base + 4); |
974 | 958 | ||
975 | if (!hwif->dma_off_quietly) | 959 | if (!hwif->dma_host_set) |
976 | hwif->dma_off_quietly = &ide_dma_off_quietly; | 960 | hwif->dma_host_set = &ide_dma_host_set; |
977 | if (!hwif->dma_host_off) | ||
978 | hwif->dma_host_off = &ide_dma_host_off; | ||
979 | if (!hwif->ide_dma_on) | ||
980 | hwif->ide_dma_on = &__ide_dma_on; | ||
981 | if (!hwif->dma_host_on) | ||
982 | hwif->dma_host_on = &ide_dma_host_on; | ||
983 | if (!hwif->dma_setup) | 961 | if (!hwif->dma_setup) |
984 | hwif->dma_setup = &ide_dma_setup; | 962 | hwif->dma_setup = &ide_dma_setup; |
985 | if (!hwif->dma_exec_cmd) | 963 | if (!hwif->dma_exec_cmd) |
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c index 0f72b98d727f..bb30c29f6ec0 100644 --- a/drivers/ide/ide-generic.c +++ b/drivers/ide/ide-generic.c | |||
@@ -14,10 +14,16 @@ | |||
14 | 14 | ||
15 | static int __init ide_generic_init(void) | 15 | static int __init ide_generic_init(void) |
16 | { | 16 | { |
17 | u8 idx[MAX_HWIFS]; | ||
18 | int i; | ||
19 | |||
17 | if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) | 20 | if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) |
18 | ide_get_lock(NULL, NULL); /* for atari only */ | 21 | ide_get_lock(NULL, NULL); /* for atari only */ |
19 | 22 | ||
20 | (void)ideprobe_init(); | 23 | for (i = 0; i < MAX_HWIFS; i++) |
24 | idx[i] = ide_hwifs[i].present ? 0xff : i; | ||
25 | |||
26 | ide_device_add_all(idx); | ||
21 | 27 | ||
22 | if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) | 28 | if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) |
23 | ide_release_lock(); /* for atari only */ | 29 | ide_release_lock(); /* for atari only */ |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 2711b5a6962d..6f8f544392a8 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -75,7 +75,7 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, | |||
75 | */ | 75 | */ |
76 | if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) { | 76 | if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) { |
77 | drive->state = 0; | 77 | drive->state = 0; |
78 | HWGROUP(drive)->hwif->ide_dma_on(drive); | 78 | ide_dma_on(drive); |
79 | } | 79 | } |
80 | 80 | ||
81 | if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { | 81 | if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { |
@@ -219,7 +219,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
219 | * we could be smarter and check for current xfer_speed | 219 | * we could be smarter and check for current xfer_speed |
220 | * in struct drive etc... | 220 | * in struct drive etc... |
221 | */ | 221 | */ |
222 | if (drive->hwif->ide_dma_on == NULL) | 222 | if (drive->hwif->dma_host_set == NULL) |
223 | break; | 223 | break; |
224 | /* | 224 | /* |
225 | * TODO: respect ->using_dma setting | 225 | * TODO: respect ->using_dma setting |
@@ -231,7 +231,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
231 | return ide_stopped; | 231 | return ide_stopped; |
232 | 232 | ||
233 | out_do_tf: | 233 | out_do_tf: |
234 | args->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 234 | args->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
235 | args->data_phase = TASKFILE_NO_DATA; | 235 | args->data_phase = TASKFILE_NO_DATA; |
236 | return do_rw_taskfile(drive, args); | 236 | return do_rw_taskfile(drive, args); |
237 | } | 237 | } |
@@ -354,7 +354,6 @@ void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
354 | 354 | ||
355 | void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | 355 | void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) |
356 | { | 356 | { |
357 | ide_hwif_t *hwif = HWIF(drive); | ||
358 | unsigned long flags; | 357 | unsigned long flags; |
359 | struct request *rq; | 358 | struct request *rq; |
360 | 359 | ||
@@ -362,17 +361,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
362 | rq = HWGROUP(drive)->rq; | 361 | rq = HWGROUP(drive)->rq; |
363 | spin_unlock_irqrestore(&ide_lock, flags); | 362 | spin_unlock_irqrestore(&ide_lock, flags); |
364 | 363 | ||
365 | if (rq->cmd_type == REQ_TYPE_ATA_CMD) { | 364 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
366 | u8 *args = (u8 *) rq->buffer; | ||
367 | if (rq->errors == 0) | ||
368 | rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); | ||
369 | |||
370 | if (args) { | ||
371 | args[0] = stat; | ||
372 | args[1] = err; | ||
373 | args[2] = hwif->INB(IDE_NSECTOR_REG); | ||
374 | } | ||
375 | } else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | ||
376 | ide_task_t *args = (ide_task_t *) rq->special; | 365 | ide_task_t *args = (ide_task_t *) rq->special; |
377 | if (rq->errors == 0) | 366 | if (rq->errors == 0) |
378 | rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); | 367 | rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); |
@@ -383,10 +372,6 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
383 | tf->error = err; | 372 | tf->error = err; |
384 | tf->status = stat; | 373 | tf->status = stat; |
385 | 374 | ||
386 | args->tf_flags |= (IDE_TFLAG_IN_TF|IDE_TFLAG_IN_DEVICE); | ||
387 | if (args->tf_flags & IDE_TFLAG_LBA48) | ||
388 | args->tf_flags |= IDE_TFLAG_IN_HOB; | ||
389 | |||
390 | ide_tf_read(drive, args); | 375 | ide_tf_read(drive, args); |
391 | } | 376 | } |
392 | } else if (blk_pm_request(rq)) { | 377 | } else if (blk_pm_request(rq)) { |
@@ -626,42 +611,6 @@ ide_startstop_t ide_abort(ide_drive_t *drive, const char *msg) | |||
626 | return __ide_abort(drive, rq); | 611 | return __ide_abort(drive, rq); |
627 | } | 612 | } |
628 | 613 | ||
629 | /** | ||
630 | * drive_cmd_intr - drive command completion interrupt | ||
631 | * @drive: drive the completion interrupt occurred on | ||
632 | * | ||
633 | * drive_cmd_intr() is invoked on completion of a special DRIVE_CMD. | ||
634 | * We do any necessary data reading and then wait for the drive to | ||
635 | * go non busy. At that point we may read the error data and complete | ||
636 | * the request | ||
637 | */ | ||
638 | |||
639 | static ide_startstop_t drive_cmd_intr (ide_drive_t *drive) | ||
640 | { | ||
641 | struct request *rq = HWGROUP(drive)->rq; | ||
642 | ide_hwif_t *hwif = HWIF(drive); | ||
643 | u8 *args = (u8 *) rq->buffer; | ||
644 | u8 stat = hwif->INB(IDE_STATUS_REG); | ||
645 | int retries = 10; | ||
646 | |||
647 | local_irq_enable_in_hardirq(); | ||
648 | if (rq->cmd_type == REQ_TYPE_ATA_CMD && | ||
649 | (stat & DRQ_STAT) && args && args[3]) { | ||
650 | u8 io_32bit = drive->io_32bit; | ||
651 | drive->io_32bit = 0; | ||
652 | hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS); | ||
653 | drive->io_32bit = io_32bit; | ||
654 | while (((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && retries--) | ||
655 | udelay(100); | ||
656 | } | ||
657 | |||
658 | if (!OK_STAT(stat, READY_STAT, BAD_STAT)) | ||
659 | return ide_error(drive, "drive_cmd", stat); | ||
660 | /* calls ide_end_drive_cmd */ | ||
661 | ide_end_drive_cmd(drive, stat, hwif->INB(IDE_ERROR_REG)); | ||
662 | return ide_stopped; | ||
663 | } | ||
664 | |||
665 | static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) | 614 | static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) |
666 | { | 615 | { |
667 | tf->nsect = drive->sect; | 616 | tf->nsect = drive->sect; |
@@ -710,7 +659,7 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) | |||
710 | return ide_stopped; | 659 | return ide_stopped; |
711 | } | 660 | } |
712 | 661 | ||
713 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | | 662 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | |
714 | IDE_TFLAG_CUSTOM_HANDLER; | 663 | IDE_TFLAG_CUSTOM_HANDLER; |
715 | 664 | ||
716 | do_rw_taskfile(drive, &args); | 665 | do_rw_taskfile(drive, &args); |
@@ -787,7 +736,7 @@ static ide_startstop_t do_special (ide_drive_t *drive) | |||
787 | 736 | ||
788 | if (hwif->host_flags & IDE_HFLAG_SET_PIO_MODE_KEEP_DMA) { | 737 | if (hwif->host_flags & IDE_HFLAG_SET_PIO_MODE_KEEP_DMA) { |
789 | if (keep_dma) | 738 | if (keep_dma) |
790 | hwif->ide_dma_on(drive); | 739 | ide_dma_on(drive); |
791 | } | 740 | } |
792 | } | 741 | } |
793 | 742 | ||
@@ -847,16 +796,9 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
847 | struct request *rq) | 796 | struct request *rq) |
848 | { | 797 | { |
849 | ide_hwif_t *hwif = HWIF(drive); | 798 | ide_hwif_t *hwif = HWIF(drive); |
850 | u8 *args = rq->buffer; | 799 | ide_task_t *task = rq->special; |
851 | ide_task_t ltask; | ||
852 | struct ide_taskfile *tf = <ask.tf; | ||
853 | |||
854 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | ||
855 | ide_task_t *task = rq->special; | ||
856 | |||
857 | if (task == NULL) | ||
858 | goto done; | ||
859 | 800 | ||
801 | if (task) { | ||
860 | hwif->data_phase = task->data_phase; | 802 | hwif->data_phase = task->data_phase; |
861 | 803 | ||
862 | switch (hwif->data_phase) { | 804 | switch (hwif->data_phase) { |
@@ -873,33 +815,6 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
873 | return do_rw_taskfile(drive, task); | 815 | return do_rw_taskfile(drive, task); |
874 | } | 816 | } |
875 | 817 | ||
876 | if (args == NULL) | ||
877 | goto done; | ||
878 | |||
879 | memset(<ask, 0, sizeof(ltask)); | ||
880 | if (rq->cmd_type == REQ_TYPE_ATA_CMD) { | ||
881 | #ifdef DEBUG | ||
882 | printk("%s: DRIVE_CMD\n", drive->name); | ||
883 | #endif | ||
884 | tf->feature = args[2]; | ||
885 | if (args[0] == WIN_SMART) { | ||
886 | tf->nsect = args[3]; | ||
887 | tf->lbal = args[1]; | ||
888 | tf->lbam = 0x4f; | ||
889 | tf->lbah = 0xc2; | ||
890 | ltask.tf_flags = IDE_TFLAG_OUT_TF; | ||
891 | } else { | ||
892 | tf->nsect = args[1]; | ||
893 | ltask.tf_flags = IDE_TFLAG_OUT_FEATURE | | ||
894 | IDE_TFLAG_OUT_NSECT; | ||
895 | } | ||
896 | } | ||
897 | tf->command = args[0]; | ||
898 | ide_tf_load(drive, <ask); | ||
899 | ide_execute_command(drive, args[0], &drive_cmd_intr, WAIT_WORSTCASE, NULL); | ||
900 | return ide_started; | ||
901 | |||
902 | done: | ||
903 | /* | 818 | /* |
904 | * NULL is actually a valid way of waiting for | 819 | * NULL is actually a valid way of waiting for |
905 | * all current requests to be flushed from the queue. | 820 | * all current requests to be flushed from the queue. |
@@ -939,8 +854,7 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
939 | if (rc) | 854 | if (rc) |
940 | printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); | 855 | printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); |
941 | SELECT_DRIVE(drive); | 856 | SELECT_DRIVE(drive); |
942 | if (IDE_CONTROL_REG) | 857 | ide_set_irq(drive, 1); |
943 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); | ||
944 | rc = ide_wait_not_busy(HWIF(drive), 100000); | 858 | rc = ide_wait_not_busy(HWIF(drive), 100000); |
945 | if (rc) | 859 | if (rc) |
946 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); | 860 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); |
@@ -1004,8 +918,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) | |||
1004 | if (drive->current_speed == 0xff) | 918 | if (drive->current_speed == 0xff) |
1005 | ide_config_drive_speed(drive, drive->desired_speed); | 919 | ide_config_drive_speed(drive, drive->desired_speed); |
1006 | 920 | ||
1007 | if (rq->cmd_type == REQ_TYPE_ATA_CMD || | 921 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) |
1008 | rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | ||
1009 | return execute_drive_cmd(drive, rq); | 922 | return execute_drive_cmd(drive, rq); |
1010 | else if (blk_pm_request(rq)) { | 923 | else if (blk_pm_request(rq)) { |
1011 | struct request_pm_state *pm = rq->data; | 924 | struct request_pm_state *pm = rq->data; |
@@ -1213,15 +1126,13 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
1213 | } | 1126 | } |
1214 | again: | 1127 | again: |
1215 | hwif = HWIF(drive); | 1128 | hwif = HWIF(drive); |
1216 | if (hwgroup->hwif->sharing_irq && | 1129 | if (hwgroup->hwif->sharing_irq && hwif != hwgroup->hwif) { |
1217 | hwif != hwgroup->hwif && | ||
1218 | hwif->io_ports[IDE_CONTROL_OFFSET]) { | ||
1219 | /* | 1130 | /* |
1220 | * set nIEN for previous hwif, drives in the | 1131 | * set nIEN for previous hwif, drives in the |
1221 | * quirk_list may not like intr setups/cleanups | 1132 | * quirk_list may not like intr setups/cleanups |
1222 | */ | 1133 | */ |
1223 | if (drive->quirk_list != 1) | 1134 | if (drive->quirk_list != 1) |
1224 | hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG); | 1135 | ide_set_irq(drive, 0); |
1225 | } | 1136 | } |
1226 | hwgroup->hwif = hwif; | 1137 | hwgroup->hwif = hwif; |
1227 | hwgroup->drive = drive; | 1138 | hwgroup->drive = drive; |
@@ -1334,7 +1245,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) | |||
1334 | */ | 1245 | */ |
1335 | drive->retry_pio++; | 1246 | drive->retry_pio++; |
1336 | drive->state = DMA_PIO_RETRY; | 1247 | drive->state = DMA_PIO_RETRY; |
1337 | hwif->dma_off_quietly(drive); | 1248 | ide_dma_off_quietly(drive); |
1338 | 1249 | ||
1339 | /* | 1250 | /* |
1340 | * un-busy drive etc (hwgroup->busy is cleared on return) and | 1251 | * un-busy drive etc (hwgroup->busy is cleared on return) and |
@@ -1679,7 +1590,6 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
1679 | void ide_init_drive_cmd (struct request *rq) | 1590 | void ide_init_drive_cmd (struct request *rq) |
1680 | { | 1591 | { |
1681 | memset(rq, 0, sizeof(*rq)); | 1592 | memset(rq, 0, sizeof(*rq)); |
1682 | rq->cmd_type = REQ_TYPE_ATA_CMD; | ||
1683 | rq->ref_count = 1; | 1593 | rq->ref_count = 1; |
1684 | } | 1594 | } |
1685 | 1595 | ||
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index c97c0719ddf1..e2a7e95e1636 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -619,7 +619,7 @@ no_80w: | |||
619 | int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) | 619 | int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) |
620 | { | 620 | { |
621 | if (args->tf.command == WIN_SETFEATURES && | 621 | if (args->tf.command == WIN_SETFEATURES && |
622 | args->tf.lbal > XFER_UDMA_2 && | 622 | args->tf.nsect > XFER_UDMA_2 && |
623 | args->tf.feature == SETFEATURES_XFER) { | 623 | args->tf.feature == SETFEATURES_XFER) { |
624 | if (eighty_ninty_three(drive) == 0) { | 624 | if (eighty_ninty_three(drive) == 0) { |
625 | printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " | 625 | printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " |
@@ -639,7 +639,7 @@ int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) | |||
639 | int set_transfer (ide_drive_t *drive, ide_task_t *args) | 639 | int set_transfer (ide_drive_t *drive, ide_task_t *args) |
640 | { | 640 | { |
641 | if (args->tf.command == WIN_SETFEATURES && | 641 | if (args->tf.command == WIN_SETFEATURES && |
642 | args->tf.lbal >= XFER_SW_DMA_0 && | 642 | args->tf.nsect >= XFER_SW_DMA_0 && |
643 | args->tf.feature == SETFEATURES_XFER && | 643 | args->tf.feature == SETFEATURES_XFER && |
644 | (drive->id->dma_ultra || | 644 | (drive->id->dma_ultra || |
645 | drive->id->dma_mword || | 645 | drive->id->dma_mword || |
@@ -688,8 +688,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
688 | */ | 688 | */ |
689 | 689 | ||
690 | SELECT_MASK(drive, 1); | 690 | SELECT_MASK(drive, 1); |
691 | if (IDE_CONTROL_REG) | 691 | ide_set_irq(drive, 1); |
692 | hwif->OUTB(drive->ctl,IDE_CONTROL_REG); | ||
693 | msleep(50); | 692 | msleep(50); |
694 | hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG); | 693 | hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG); |
695 | timeout = jiffies + WAIT_WORSTCASE; | 694 | timeout = jiffies + WAIT_WORSTCASE; |
@@ -742,8 +741,8 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
742 | // msleep(50); | 741 | // msleep(50); |
743 | 742 | ||
744 | #ifdef CONFIG_BLK_DEV_IDEDMA | 743 | #ifdef CONFIG_BLK_DEV_IDEDMA |
745 | if (hwif->ide_dma_on) /* check if host supports DMA */ | 744 | if (hwif->dma_host_set) /* check if host supports DMA */ |
746 | hwif->dma_host_off(drive); | 745 | hwif->dma_host_set(drive, 0); |
747 | #endif | 746 | #endif |
748 | 747 | ||
749 | /* Skip setting PIO flow-control modes on pre-EIDE drives */ | 748 | /* Skip setting PIO flow-control modes on pre-EIDE drives */ |
@@ -772,13 +771,12 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
772 | SELECT_DRIVE(drive); | 771 | SELECT_DRIVE(drive); |
773 | SELECT_MASK(drive, 0); | 772 | SELECT_MASK(drive, 0); |
774 | udelay(1); | 773 | udelay(1); |
775 | if (IDE_CONTROL_REG) | 774 | ide_set_irq(drive, 0); |
776 | hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG); | ||
777 | hwif->OUTB(speed, IDE_NSECTOR_REG); | 775 | hwif->OUTB(speed, IDE_NSECTOR_REG); |
778 | hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); | 776 | hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); |
779 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); | 777 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); |
780 | if ((IDE_CONTROL_REG) && (drive->quirk_list == 2)) | 778 | if (drive->quirk_list == 2) |
781 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); | 779 | ide_set_irq(drive, 1); |
782 | 780 | ||
783 | error = __ide_wait_stat(drive, drive->ready_stat, | 781 | error = __ide_wait_stat(drive, drive->ready_stat, |
784 | BUSY_STAT|DRQ_STAT|ERR_STAT, | 782 | BUSY_STAT|DRQ_STAT|ERR_STAT, |
@@ -799,10 +797,11 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
799 | 797 | ||
800 | skip: | 798 | skip: |
801 | #ifdef CONFIG_BLK_DEV_IDEDMA | 799 | #ifdef CONFIG_BLK_DEV_IDEDMA |
802 | if (speed >= XFER_SW_DMA_0) | 800 | if ((speed >= XFER_SW_DMA_0 || (hwif->host_flags & IDE_HFLAG_VDMA)) && |
803 | hwif->dma_host_on(drive); | 801 | drive->using_dma) |
804 | else if (hwif->ide_dma_on) /* check if host supports DMA */ | 802 | hwif->dma_host_set(drive, 1); |
805 | hwif->dma_off_quietly(drive); | 803 | else if (hwif->dma_host_set) /* check if host supports DMA */ |
804 | ide_dma_off_quietly(drive); | ||
806 | #endif | 805 | #endif |
807 | 806 | ||
808 | switch(speed) { | 807 | switch(speed) { |
@@ -1012,10 +1011,10 @@ static void check_dma_crc(ide_drive_t *drive) | |||
1012 | { | 1011 | { |
1013 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1012 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1014 | if (drive->crc_count) { | 1013 | if (drive->crc_count) { |
1015 | drive->hwif->dma_off_quietly(drive); | 1014 | ide_dma_off_quietly(drive); |
1016 | ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive)); | 1015 | ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive)); |
1017 | if (drive->current_speed >= XFER_SW_DMA_0) | 1016 | if (drive->current_speed >= XFER_SW_DMA_0) |
1018 | (void) HWIF(drive)->ide_dma_on(drive); | 1017 | ide_dma_on(drive); |
1019 | } else | 1018 | } else |
1020 | ide_dma_off(drive); | 1019 | ide_dma_off(drive); |
1021 | #endif | 1020 | #endif |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index a3bd8e8ed6b0..9b44fbdfe41f 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -454,8 +454,7 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) | |||
454 | static void ide_dump_opcode(ide_drive_t *drive) | 454 | static void ide_dump_opcode(ide_drive_t *drive) |
455 | { | 455 | { |
456 | struct request *rq; | 456 | struct request *rq; |
457 | u8 opcode = 0; | 457 | ide_task_t *task = NULL; |
458 | int found = 0; | ||
459 | 458 | ||
460 | spin_lock(&ide_lock); | 459 | spin_lock(&ide_lock); |
461 | rq = NULL; | 460 | rq = NULL; |
@@ -464,25 +463,15 @@ static void ide_dump_opcode(ide_drive_t *drive) | |||
464 | spin_unlock(&ide_lock); | 463 | spin_unlock(&ide_lock); |
465 | if (!rq) | 464 | if (!rq) |
466 | return; | 465 | return; |
467 | if (rq->cmd_type == REQ_TYPE_ATA_CMD) { | 466 | |
468 | char *args = rq->buffer; | 467 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) |
469 | if (args) { | 468 | task = rq->special; |
470 | opcode = args[0]; | ||
471 | found = 1; | ||
472 | } | ||
473 | } else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | ||
474 | ide_task_t *args = rq->special; | ||
475 | if (args) { | ||
476 | opcode = args->tf.command; | ||
477 | found = 1; | ||
478 | } | ||
479 | } | ||
480 | 469 | ||
481 | printk("ide: failed opcode was: "); | 470 | printk("ide: failed opcode was: "); |
482 | if (!found) | 471 | if (task == NULL) |
483 | printk("unknown\n"); | 472 | printk(KERN_CONT "unknown\n"); |
484 | else | 473 | else |
485 | printk("0x%02x\n", opcode); | 474 | printk(KERN_CONT "0x%02x\n", task->tf.command); |
486 | } | 475 | } |
487 | 476 | ||
488 | u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48) | 477 | u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48) |
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index e245521af7b5..cbbb0f75be92 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c | |||
@@ -31,7 +31,6 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id | |||
31 | { | 31 | { |
32 | hw_regs_t hw; | 32 | hw_regs_t hw; |
33 | ide_hwif_t *hwif; | 33 | ide_hwif_t *hwif; |
34 | int index; | ||
35 | 34 | ||
36 | if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0))) | 35 | if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0))) |
37 | return -1; | 36 | return -1; |
@@ -41,11 +40,19 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id | |||
41 | pnp_port_start(dev, 1)); | 40 | pnp_port_start(dev, 1)); |
42 | hw.irq = pnp_irq(dev, 0); | 41 | hw.irq = pnp_irq(dev, 0); |
43 | 42 | ||
44 | index = ide_register_hw(&hw, NULL, 1, &hwif); | 43 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
44 | if (hwif) { | ||
45 | u8 index = hwif->index; | ||
46 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | ||
47 | |||
48 | ide_init_port_data(hwif, index); | ||
49 | ide_init_port_hw(hwif, &hw); | ||
45 | 50 | ||
46 | if (index != -1) { | 51 | printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); |
47 | printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); | ||
48 | pnp_set_drvdata(dev,hwif); | 52 | pnp_set_drvdata(dev,hwif); |
53 | |||
54 | ide_device_add(idx); | ||
55 | |||
49 | return 0; | 56 | return 0; |
50 | } | 57 | } |
51 | 58 | ||
@@ -68,12 +75,15 @@ static struct pnp_driver idepnp_driver = { | |||
68 | .remove = idepnp_remove, | 75 | .remove = idepnp_remove, |
69 | }; | 76 | }; |
70 | 77 | ||
71 | void __init pnpide_init(void) | 78 | static int __init pnpide_init(void) |
72 | { | 79 | { |
73 | pnp_register_driver(&idepnp_driver); | 80 | return pnp_register_driver(&idepnp_driver); |
74 | } | 81 | } |
75 | 82 | ||
76 | void __exit pnpide_exit(void) | 83 | static void __exit pnpide_exit(void) |
77 | { | 84 | { |
78 | pnp_unregister_driver(&idepnp_driver); | 85 | pnp_unregister_driver(&idepnp_driver); |
79 | } | 86 | } |
87 | |||
88 | module_init(pnpide_init); | ||
89 | module_exit(pnpide_exit); | ||
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 0379d1f697cf..edf650b20c67 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -235,9 +235,6 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) | |||
235 | drive->media = ide_disk; | 235 | drive->media = ide_disk; |
236 | printk("%s DISK drive\n", (id->config == 0x848a) ? "CFA" : "ATA" ); | 236 | printk("%s DISK drive\n", (id->config == 0x848a) ? "CFA" : "ATA" ); |
237 | 237 | ||
238 | if (hwif->quirkproc) | ||
239 | drive->quirk_list = hwif->quirkproc(drive); | ||
240 | |||
241 | return; | 238 | return; |
242 | 239 | ||
243 | err_misc: | 240 | err_misc: |
@@ -353,22 +350,19 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd) | |||
353 | * the irq handler isn't expecting. | 350 | * the irq handler isn't expecting. |
354 | */ | 351 | */ |
355 | if (IDE_CONTROL_REG) { | 352 | if (IDE_CONTROL_REG) { |
356 | u8 ctl = drive->ctl | 2; | ||
357 | if (!hwif->irq) { | 353 | if (!hwif->irq) { |
358 | autoprobe = 1; | 354 | autoprobe = 1; |
359 | cookie = probe_irq_on(); | 355 | cookie = probe_irq_on(); |
360 | /* enable device irq */ | ||
361 | ctl &= ~2; | ||
362 | } | 356 | } |
363 | hwif->OUTB(ctl, IDE_CONTROL_REG); | 357 | ide_set_irq(drive, autoprobe); |
364 | } | 358 | } |
365 | 359 | ||
366 | retval = actual_try_to_identify(drive, cmd); | 360 | retval = actual_try_to_identify(drive, cmd); |
367 | 361 | ||
368 | if (autoprobe) { | 362 | if (autoprobe) { |
369 | int irq; | 363 | int irq; |
370 | /* mask device irq */ | 364 | |
371 | hwif->OUTB(drive->ctl|2, IDE_CONTROL_REG); | 365 | ide_set_irq(drive, 0); |
372 | /* clear drive IRQ */ | 366 | /* clear drive IRQ */ |
373 | (void) hwif->INB(IDE_STATUS_REG); | 367 | (void) hwif->INB(IDE_STATUS_REG); |
374 | udelay(5); | 368 | udelay(5); |
@@ -388,6 +382,20 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd) | |||
388 | return retval; | 382 | return retval; |
389 | } | 383 | } |
390 | 384 | ||
385 | static int ide_busy_sleep(ide_hwif_t *hwif) | ||
386 | { | ||
387 | unsigned long timeout = jiffies + WAIT_WORSTCASE; | ||
388 | u8 stat; | ||
389 | |||
390 | do { | ||
391 | msleep(50); | ||
392 | stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); | ||
393 | if ((stat & BUSY_STAT) == 0) | ||
394 | return 0; | ||
395 | } while (time_before(jiffies, timeout)); | ||
396 | |||
397 | return 1; | ||
398 | } | ||
391 | 399 | ||
392 | /** | 400 | /** |
393 | * do_probe - probe an IDE device | 401 | * do_probe - probe an IDE device |
@@ -456,7 +464,6 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
456 | if ((rc == 1 && cmd == WIN_PIDENTIFY) && | 464 | if ((rc == 1 && cmd == WIN_PIDENTIFY) && |
457 | ((drive->autotune == IDE_TUNE_DEFAULT) || | 465 | ((drive->autotune == IDE_TUNE_DEFAULT) || |
458 | (drive->autotune == IDE_TUNE_AUTO))) { | 466 | (drive->autotune == IDE_TUNE_AUTO))) { |
459 | unsigned long timeout; | ||
460 | printk("%s: no response (status = 0x%02x), " | 467 | printk("%s: no response (status = 0x%02x), " |
461 | "resetting drive\n", drive->name, | 468 | "resetting drive\n", drive->name, |
462 | hwif->INB(IDE_STATUS_REG)); | 469 | hwif->INB(IDE_STATUS_REG)); |
@@ -464,10 +471,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
464 | hwif->OUTB(drive->select.all, IDE_SELECT_REG); | 471 | hwif->OUTB(drive->select.all, IDE_SELECT_REG); |
465 | msleep(50); | 472 | msleep(50); |
466 | hwif->OUTB(WIN_SRST, IDE_COMMAND_REG); | 473 | hwif->OUTB(WIN_SRST, IDE_COMMAND_REG); |
467 | timeout = jiffies; | 474 | (void)ide_busy_sleep(hwif); |
468 | while (((hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && | ||
469 | time_before(jiffies, timeout + WAIT_WORSTCASE)) | ||
470 | msleep(50); | ||
471 | rc = try_to_identify(drive, cmd); | 475 | rc = try_to_identify(drive, cmd); |
472 | } | 476 | } |
473 | if (rc == 1) | 477 | if (rc == 1) |
@@ -495,20 +499,16 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
495 | static void enable_nest (ide_drive_t *drive) | 499 | static void enable_nest (ide_drive_t *drive) |
496 | { | 500 | { |
497 | ide_hwif_t *hwif = HWIF(drive); | 501 | ide_hwif_t *hwif = HWIF(drive); |
498 | unsigned long timeout; | ||
499 | 502 | ||
500 | printk("%s: enabling %s -- ", hwif->name, drive->id->model); | 503 | printk("%s: enabling %s -- ", hwif->name, drive->id->model); |
501 | SELECT_DRIVE(drive); | 504 | SELECT_DRIVE(drive); |
502 | msleep(50); | 505 | msleep(50); |
503 | hwif->OUTB(EXABYTE_ENABLE_NEST, IDE_COMMAND_REG); | 506 | hwif->OUTB(EXABYTE_ENABLE_NEST, IDE_COMMAND_REG); |
504 | timeout = jiffies + WAIT_WORSTCASE; | 507 | |
505 | do { | 508 | if (ide_busy_sleep(hwif)) { |
506 | if (time_after(jiffies, timeout)) { | 509 | printk(KERN_CONT "failed (timeout)\n"); |
507 | printk("failed (timeout)\n"); | 510 | return; |
508 | return; | 511 | } |
509 | } | ||
510 | msleep(50); | ||
511 | } while ((hwif->INB(IDE_STATUS_REG)) & BUSY_STAT); | ||
512 | 512 | ||
513 | msleep(50); | 513 | msleep(50); |
514 | 514 | ||
@@ -656,8 +656,7 @@ static int wait_hwif_ready(ide_hwif_t *hwif) | |||
656 | /* Ignore disks that we will not probe for later. */ | 656 | /* Ignore disks that we will not probe for later. */ |
657 | if (!drive->noprobe || drive->present) { | 657 | if (!drive->noprobe || drive->present) { |
658 | SELECT_DRIVE(drive); | 658 | SELECT_DRIVE(drive); |
659 | if (IDE_CONTROL_REG) | 659 | ide_set_irq(drive, 1); |
660 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); | ||
661 | mdelay(2); | 660 | mdelay(2); |
662 | rc = ide_wait_not_busy(hwif, 35000); | 661 | rc = ide_wait_not_busy(hwif, 35000); |
663 | if (rc) | 662 | if (rc) |
@@ -676,19 +675,18 @@ out: | |||
676 | 675 | ||
677 | /** | 676 | /** |
678 | * ide_undecoded_slave - look for bad CF adapters | 677 | * ide_undecoded_slave - look for bad CF adapters |
679 | * @hwif: interface | 678 | * @drive1: drive |
680 | * | 679 | * |
681 | * Analyse the drives on the interface and attempt to decide if we | 680 | * Analyse the drives on the interface and attempt to decide if we |
682 | * have the same drive viewed twice. This occurs with crap CF adapters | 681 | * have the same drive viewed twice. This occurs with crap CF adapters |
683 | * and PCMCIA sometimes. | 682 | * and PCMCIA sometimes. |
684 | */ | 683 | */ |
685 | 684 | ||
686 | void ide_undecoded_slave(ide_hwif_t *hwif) | 685 | void ide_undecoded_slave(ide_drive_t *drive1) |
687 | { | 686 | { |
688 | ide_drive_t *drive0 = &hwif->drives[0]; | 687 | ide_drive_t *drive0 = &drive1->hwif->drives[0]; |
689 | ide_drive_t *drive1 = &hwif->drives[1]; | ||
690 | 688 | ||
691 | if (drive0->present == 0 || drive1->present == 0) | 689 | if ((drive1->dn & 1) == 0 || drive0->present == 0) |
692 | return; | 690 | return; |
693 | 691 | ||
694 | /* If the models don't match they are not the same product */ | 692 | /* If the models don't match they are not the same product */ |
@@ -791,18 +789,11 @@ static void probe_hwif(ide_hwif_t *hwif) | |||
791 | } | 789 | } |
792 | } | 790 | } |
793 | if (hwif->io_ports[IDE_CONTROL_OFFSET] && hwif->reset) { | 791 | if (hwif->io_ports[IDE_CONTROL_OFFSET] && hwif->reset) { |
794 | unsigned long timeout = jiffies + WAIT_WORSTCASE; | ||
795 | u8 stat; | ||
796 | |||
797 | printk(KERN_WARNING "%s: reset\n", hwif->name); | 792 | printk(KERN_WARNING "%s: reset\n", hwif->name); |
798 | hwif->OUTB(12, hwif->io_ports[IDE_CONTROL_OFFSET]); | 793 | hwif->OUTB(12, hwif->io_ports[IDE_CONTROL_OFFSET]); |
799 | udelay(10); | 794 | udelay(10); |
800 | hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); | 795 | hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); |
801 | do { | 796 | (void)ide_busy_sleep(hwif); |
802 | msleep(50); | ||
803 | stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); | ||
804 | } while ((stat & BUSY_STAT) && time_after(timeout, jiffies)); | ||
805 | |||
806 | } | 797 | } |
807 | local_irq_restore(flags); | 798 | local_irq_restore(flags); |
808 | /* | 799 | /* |
@@ -817,8 +808,12 @@ static void probe_hwif(ide_hwif_t *hwif) | |||
817 | return; | 808 | return; |
818 | } | 809 | } |
819 | 810 | ||
820 | if (hwif->fixup) | 811 | for (unit = 0; unit < MAX_DRIVES; unit++) { |
821 | hwif->fixup(hwif); | 812 | ide_drive_t *drive = &hwif->drives[unit]; |
813 | |||
814 | if (drive->present && hwif->quirkproc) | ||
815 | hwif->quirkproc(drive); | ||
816 | } | ||
822 | 817 | ||
823 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 818 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
824 | ide_drive_t *drive = &hwif->drives[unit]; | 819 | ide_drive_t *drive = &hwif->drives[unit]; |
@@ -833,7 +828,7 @@ static void probe_hwif(ide_hwif_t *hwif) | |||
833 | 828 | ||
834 | drive->nice1 = 1; | 829 | drive->nice1 = 1; |
835 | 830 | ||
836 | if (hwif->ide_dma_on) | 831 | if (hwif->dma_host_set) |
837 | ide_set_dma(drive); | 832 | ide_set_dma(drive); |
838 | } | 833 | } |
839 | } | 834 | } |
@@ -848,25 +843,6 @@ static void probe_hwif(ide_hwif_t *hwif) | |||
848 | } | 843 | } |
849 | } | 844 | } |
850 | 845 | ||
851 | static int hwif_init(ide_hwif_t *hwif); | ||
852 | static void hwif_register_devices(ide_hwif_t *hwif); | ||
853 | |||
854 | static int probe_hwif_init(ide_hwif_t *hwif) | ||
855 | { | ||
856 | probe_hwif(hwif); | ||
857 | |||
858 | if (!hwif_init(hwif)) { | ||
859 | printk(KERN_INFO "%s: failed to initialize IDE interface\n", | ||
860 | hwif->name); | ||
861 | return -1; | ||
862 | } | ||
863 | |||
864 | if (hwif->present) | ||
865 | hwif_register_devices(hwif); | ||
866 | |||
867 | return 0; | ||
868 | } | ||
869 | |||
870 | #if MAX_HWIFS > 1 | 846 | #if MAX_HWIFS > 1 |
871 | /* | 847 | /* |
872 | * save_match() is used to simplify logic in init_irq() below. | 848 | * save_match() is used to simplify logic in init_irq() below. |
@@ -1359,54 +1335,63 @@ static void hwif_register_devices(ide_hwif_t *hwif) | |||
1359 | } | 1335 | } |
1360 | } | 1336 | } |
1361 | 1337 | ||
1362 | int ideprobe_init (void) | 1338 | int ide_device_add_all(u8 *idx) |
1363 | { | 1339 | { |
1364 | unsigned int index; | 1340 | ide_hwif_t *hwif; |
1365 | int probe[MAX_HWIFS]; | 1341 | int i, rc = 0; |
1366 | 1342 | ||
1367 | memset(probe, 0, MAX_HWIFS * sizeof(int)); | 1343 | for (i = 0; i < MAX_HWIFS; i++) { |
1368 | for (index = 0; index < MAX_HWIFS; ++index) | 1344 | if (idx[i] == 0xff) |
1369 | probe[index] = !ide_hwifs[index].present; | 1345 | continue; |
1370 | 1346 | ||
1371 | for (index = 0; index < MAX_HWIFS; ++index) | 1347 | probe_hwif(&ide_hwifs[idx[i]]); |
1372 | if (probe[index]) | 1348 | } |
1373 | probe_hwif(&ide_hwifs[index]); | 1349 | |
1374 | for (index = 0; index < MAX_HWIFS; ++index) | 1350 | for (i = 0; i < MAX_HWIFS; i++) { |
1375 | if (probe[index]) | 1351 | if (idx[i] == 0xff) |
1376 | hwif_init(&ide_hwifs[index]); | 1352 | continue; |
1377 | for (index = 0; index < MAX_HWIFS; ++index) { | 1353 | |
1378 | if (probe[index]) { | 1354 | hwif = &ide_hwifs[idx[i]]; |
1379 | ide_hwif_t *hwif = &ide_hwifs[index]; | 1355 | |
1380 | if (!hwif->present) | 1356 | if (hwif_init(hwif) == 0) { |
1381 | continue; | 1357 | printk(KERN_INFO "%s: failed to initialize IDE " |
1382 | if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) | 1358 | "interface\n", hwif->name); |
1383 | hwif->chipset = ide_generic; | 1359 | rc = -1; |
1384 | hwif_register_devices(hwif); | 1360 | continue; |
1385 | } | 1361 | } |
1386 | } | 1362 | } |
1387 | for (index = 0; index < MAX_HWIFS; ++index) | ||
1388 | if (probe[index]) | ||
1389 | ide_proc_register_port(&ide_hwifs[index]); | ||
1390 | return 0; | ||
1391 | } | ||
1392 | 1363 | ||
1393 | EXPORT_SYMBOL_GPL(ideprobe_init); | 1364 | for (i = 0; i < MAX_HWIFS; i++) { |
1365 | if (idx[i] == 0xff) | ||
1366 | continue; | ||
1394 | 1367 | ||
1395 | int ide_device_add(u8 idx[4]) | 1368 | hwif = &ide_hwifs[idx[i]]; |
1396 | { | ||
1397 | int i, rc = 0; | ||
1398 | 1369 | ||
1399 | for (i = 0; i < 4; i++) { | 1370 | if (hwif->present) { |
1400 | if (idx[i] != 0xff) | 1371 | if (hwif->chipset == ide_unknown || |
1401 | rc |= probe_hwif_init(&ide_hwifs[idx[i]]); | 1372 | hwif->chipset == ide_forced) |
1373 | hwif->chipset = ide_generic; | ||
1374 | hwif_register_devices(hwif); | ||
1375 | } | ||
1402 | } | 1376 | } |
1403 | 1377 | ||
1404 | for (i = 0; i < 4; i++) { | 1378 | for (i = 0; i < MAX_HWIFS; i++) { |
1405 | if (idx[i] != 0xff) | 1379 | if (idx[i] != 0xff) |
1406 | ide_proc_register_port(&ide_hwifs[idx[i]]); | 1380 | ide_proc_register_port(&ide_hwifs[idx[i]]); |
1407 | } | 1381 | } |
1408 | 1382 | ||
1409 | return rc; | 1383 | return rc; |
1410 | } | 1384 | } |
1385 | EXPORT_SYMBOL_GPL(ide_device_add_all); | ||
1386 | |||
1387 | int ide_device_add(u8 idx[4]) | ||
1388 | { | ||
1389 | u8 idx_all[MAX_HWIFS]; | ||
1390 | int i; | ||
1411 | 1391 | ||
1392 | for (i = 0; i < MAX_HWIFS; i++) | ||
1393 | idx_all[i] = (i < 4) ? idx[i] : 0xff; | ||
1394 | |||
1395 | return ide_device_add_all(idx_all); | ||
1396 | } | ||
1412 | EXPORT_SYMBOL_GPL(ide_device_add); | 1397 | EXPORT_SYMBOL_GPL(ide_device_add); |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index a4007d30da52..aa663e7f46f2 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -346,14 +346,20 @@ static int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int va | |||
346 | 346 | ||
347 | static int set_xfer_rate (ide_drive_t *drive, int arg) | 347 | static int set_xfer_rate (ide_drive_t *drive, int arg) |
348 | { | 348 | { |
349 | ide_task_t task; | ||
349 | int err; | 350 | int err; |
350 | 351 | ||
351 | if (arg < 0 || arg > 70) | 352 | if (arg < 0 || arg > 70) |
352 | return -EINVAL; | 353 | return -EINVAL; |
353 | 354 | ||
354 | err = ide_wait_cmd(drive, | 355 | memset(&task, 0, sizeof(task)); |
355 | WIN_SETFEATURES, (u8) arg, | 356 | task.tf.command = WIN_SETFEATURES; |
356 | SETFEATURES_XFER, 0, NULL); | 357 | task.tf.feature = SETFEATURES_XFER; |
358 | task.tf.nsect = (u8)arg; | ||
359 | task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | | ||
360 | IDE_TFLAG_IN_NSECT; | ||
361 | |||
362 | err = ide_no_data_taskfile(drive, &task); | ||
357 | 363 | ||
358 | if (!err && arg) { | 364 | if (!err && arg) { |
359 | ide_set_xfer_rate(drive, (u8) arg); | 365 | ide_set_xfer_rate(drive, (u8) arg); |
diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c new file mode 100644 index 000000000000..7ffa332d77ce --- /dev/null +++ b/drivers/ide/ide-scan-pci.c | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * support for probing IDE PCI devices in the PCI bus order | ||
3 | * | ||
4 | * Copyright (c) 1998-2000 Andre Hedrick <andre@linux-ide.org> | ||
5 | * Copyright (c) 1995-1998 Mark Lord | ||
6 | * | ||
7 | * May be copied or modified under the terms of the GNU General Public License | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/ide.h> | ||
14 | |||
15 | /* | ||
16 | * Module interfaces | ||
17 | */ | ||
18 | |||
19 | static int pre_init = 1; /* Before first ordered IDE scan */ | ||
20 | static LIST_HEAD(ide_pci_drivers); | ||
21 | |||
22 | /* | ||
23 | * __ide_pci_register_driver - attach IDE driver | ||
24 | * @driver: pci driver | ||
25 | * @module: owner module of the driver | ||
26 | * | ||
27 | * Registers a driver with the IDE layer. The IDE layer arranges that | ||
28 | * boot time setup is done in the expected device order and then | ||
29 | * hands the controllers off to the core PCI code to do the rest of | ||
30 | * the work. | ||
31 | * | ||
32 | * Returns are the same as for pci_register_driver | ||
33 | */ | ||
34 | |||
35 | int __ide_pci_register_driver(struct pci_driver *driver, struct module *module, | ||
36 | const char *mod_name) | ||
37 | { | ||
38 | if (!pre_init) | ||
39 | return __pci_register_driver(driver, module, mod_name); | ||
40 | driver->driver.owner = module; | ||
41 | list_add_tail(&driver->node, &ide_pci_drivers); | ||
42 | return 0; | ||
43 | } | ||
44 | EXPORT_SYMBOL_GPL(__ide_pci_register_driver); | ||
45 | |||
46 | /** | ||
47 | * ide_scan_pcidev - find an IDE driver for a device | ||
48 | * @dev: PCI device to check | ||
49 | * | ||
50 | * Look for an IDE driver to handle the device we are considering. | ||
51 | * This is only used during boot up to get the ordering correct. After | ||
52 | * boot up the pci layer takes over the job. | ||
53 | */ | ||
54 | |||
55 | static int __init ide_scan_pcidev(struct pci_dev *dev) | ||
56 | { | ||
57 | struct list_head *l; | ||
58 | struct pci_driver *d; | ||
59 | |||
60 | list_for_each(l, &ide_pci_drivers) { | ||
61 | d = list_entry(l, struct pci_driver, node); | ||
62 | if (d->id_table) { | ||
63 | const struct pci_device_id *id = | ||
64 | pci_match_id(d->id_table, dev); | ||
65 | |||
66 | if (id != NULL && d->probe(dev, id) >= 0) { | ||
67 | dev->driver = d; | ||
68 | pci_dev_get(dev); | ||
69 | return 1; | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * ide_scan_pcibus - perform the initial IDE driver scan | ||
78 | * | ||
79 | * Perform the initial bus rather than driver ordered scan of the | ||
80 | * PCI drivers. After this all IDE pci handling becomes standard | ||
81 | * module ordering not traditionally ordered. | ||
82 | */ | ||
83 | |||
84 | int __init ide_scan_pcibus(void) | ||
85 | { | ||
86 | struct pci_dev *dev = NULL; | ||
87 | struct pci_driver *d; | ||
88 | struct list_head *l, *n; | ||
89 | |||
90 | pre_init = 0; | ||
91 | if (!ide_scan_direction) | ||
92 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev))) | ||
93 | ide_scan_pcidev(dev); | ||
94 | else | ||
95 | while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, | ||
96 | dev))) | ||
97 | ide_scan_pcidev(dev); | ||
98 | |||
99 | /* | ||
100 | * Hand the drivers over to the PCI layer now we | ||
101 | * are post init. | ||
102 | */ | ||
103 | |||
104 | list_for_each_safe(l, n, &ide_pci_drivers) { | ||
105 | list_del(l); | ||
106 | d = list_entry(l, struct pci_driver, node); | ||
107 | if (__pci_register_driver(d, d->driver.owner, | ||
108 | d->driver.mod_name)) | ||
109 | printk(KERN_ERR "%s: failed to register %s driver\n", | ||
110 | __FUNCTION__, d->driver.mod_name); | ||
111 | } | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static int __init ide_scan_pci(void) | ||
117 | { | ||
118 | return ide_scan_pcibus(); | ||
119 | } | ||
120 | |||
121 | module_init(ide_scan_pci); | ||
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 3cbca3f4628a..d71a584f0765 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1690,6 +1690,11 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) | |||
1690 | if (error) | 1690 | if (error) |
1691 | tape->failed_pc = NULL; | 1691 | tape->failed_pc = NULL; |
1692 | 1692 | ||
1693 | if (!blk_special_request(rq)) { | ||
1694 | ide_end_request(drive, uptodate, nr_sects); | ||
1695 | return 0; | ||
1696 | } | ||
1697 | |||
1693 | spin_lock_irqsave(&tape->spinlock, flags); | 1698 | spin_lock_irqsave(&tape->spinlock, flags); |
1694 | 1699 | ||
1695 | /* The request was a pipelined data transfer request */ | 1700 | /* The request was a pipelined data transfer request */ |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 2d63ea9ee61b..5eb6fa15dc4d 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -35,34 +35,6 @@ | |||
35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
36 | #include <asm/io.h> | 36 | #include <asm/io.h> |
37 | 37 | ||
38 | static void ata_bswap_data (void *buffer, int wcount) | ||
39 | { | ||
40 | u16 *p = buffer; | ||
41 | |||
42 | while (wcount--) { | ||
43 | *p = *p << 8 | *p >> 8; p++; | ||
44 | *p = *p << 8 | *p >> 8; p++; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | static void taskfile_input_data(ide_drive_t *drive, void *buffer, u32 wcount) | ||
49 | { | ||
50 | HWIF(drive)->ata_input_data(drive, buffer, wcount); | ||
51 | if (drive->bswap) | ||
52 | ata_bswap_data(buffer, wcount); | ||
53 | } | ||
54 | |||
55 | static void taskfile_output_data(ide_drive_t *drive, void *buffer, u32 wcount) | ||
56 | { | ||
57 | if (drive->bswap) { | ||
58 | ata_bswap_data(buffer, wcount); | ||
59 | HWIF(drive)->ata_output_data(drive, buffer, wcount); | ||
60 | ata_bswap_data(buffer, wcount); | ||
61 | } else { | ||
62 | HWIF(drive)->ata_output_data(drive, buffer, wcount); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | 38 | void ide_tf_load(ide_drive_t *drive, ide_task_t *task) |
67 | { | 39 | { |
68 | ide_hwif_t *hwif = drive->hwif; | 40 | ide_hwif_t *hwif = drive->hwif; |
@@ -77,10 +49,13 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | |||
77 | "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n", | 49 | "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n", |
78 | drive->name, tf->feature, tf->nsect, tf->lbal, | 50 | drive->name, tf->feature, tf->nsect, tf->lbal, |
79 | tf->lbam, tf->lbah, tf->device, tf->command); | 51 | tf->lbam, tf->lbah, tf->device, tf->command); |
52 | printk("%s: hob: nsect 0x%02x lbal 0x%02x " | ||
53 | "lbam 0x%02x lbah 0x%02x\n", | ||
54 | drive->name, tf->hob_nsect, tf->hob_lbal, | ||
55 | tf->hob_lbam, tf->hob_lbah); | ||
80 | #endif | 56 | #endif |
81 | 57 | ||
82 | if (IDE_CONTROL_REG) | 58 | ide_set_irq(drive, 1); |
83 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */ | ||
84 | 59 | ||
85 | if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0) | 60 | if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0) |
86 | SELECT_MASK(drive, 0); | 61 | SELECT_MASK(drive, 0); |
@@ -124,7 +99,7 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) | |||
124 | args.tf.command = WIN_IDENTIFY; | 99 | args.tf.command = WIN_IDENTIFY; |
125 | else | 100 | else |
126 | args.tf.command = WIN_PIDENTIFY; | 101 | args.tf.command = WIN_PIDENTIFY; |
127 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 102 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
128 | args.data_phase = TASKFILE_IN; | 103 | args.data_phase = TASKFILE_IN; |
129 | return ide_raw_taskfile(drive, &args, buf, 1); | 104 | return ide_raw_taskfile(drive, &args, buf, 1); |
130 | } | 105 | } |
@@ -285,7 +260,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) | |||
285 | return ide_stopped; | 260 | return ide_stopped; |
286 | } | 261 | } |
287 | 262 | ||
288 | static u8 wait_drive_not_busy(ide_drive_t *drive) | 263 | u8 wait_drive_not_busy(ide_drive_t *drive) |
289 | { | 264 | { |
290 | ide_hwif_t *hwif = HWIF(drive); | 265 | ide_hwif_t *hwif = HWIF(drive); |
291 | int retries; | 266 | int retries; |
@@ -293,8 +268,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive) | |||
293 | 268 | ||
294 | /* | 269 | /* |
295 | * Last sector was transfered, wait until drive is ready. | 270 | * Last sector was transfered, wait until drive is ready. |
296 | * This can take up to 10 usec, but we will wait max 1 ms | 271 | * This can take up to 10 usec, but we will wait max 1 ms. |
297 | * (drive_cmd_intr() waits that long). | ||
298 | */ | 272 | */ |
299 | for (retries = 0; retries < 100; retries++) { | 273 | for (retries = 0; retries < 100; retries++) { |
300 | if ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) | 274 | if ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) |
@@ -349,9 +323,9 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write) | |||
349 | 323 | ||
350 | /* do the actual data transfer */ | 324 | /* do the actual data transfer */ |
351 | if (write) | 325 | if (write) |
352 | taskfile_output_data(drive, buf, SECTOR_WORDS); | 326 | hwif->ata_output_data(drive, buf, SECTOR_WORDS); |
353 | else | 327 | else |
354 | taskfile_input_data(drive, buf, SECTOR_WORDS); | 328 | hwif->ata_input_data(drive, buf, SECTOR_WORDS); |
355 | 329 | ||
356 | kunmap_atomic(buf, KM_BIO_SRC_IRQ); | 330 | kunmap_atomic(buf, KM_BIO_SRC_IRQ); |
357 | #ifdef CONFIG_HIGHMEM | 331 | #ifdef CONFIG_HIGHMEM |
@@ -371,9 +345,18 @@ static void ide_pio_multi(ide_drive_t *drive, unsigned int write) | |||
371 | static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, | 345 | static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, |
372 | unsigned int write) | 346 | unsigned int write) |
373 | { | 347 | { |
348 | u8 saved_io_32bit = drive->io_32bit; | ||
349 | |||
374 | if (rq->bio) /* fs request */ | 350 | if (rq->bio) /* fs request */ |
375 | rq->errors = 0; | 351 | rq->errors = 0; |
376 | 352 | ||
353 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | ||
354 | ide_task_t *task = rq->special; | ||
355 | |||
356 | if (task->tf_flags & IDE_TFLAG_IO_16BIT) | ||
357 | drive->io_32bit = 0; | ||
358 | } | ||
359 | |||
377 | touch_softlockup_watchdog(); | 360 | touch_softlockup_watchdog(); |
378 | 361 | ||
379 | switch (drive->hwif->data_phase) { | 362 | switch (drive->hwif->data_phase) { |
@@ -385,6 +368,8 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, | |||
385 | ide_pio_sector(drive, write); | 368 | ide_pio_sector(drive, write); |
386 | break; | 369 | break; |
387 | } | 370 | } |
371 | |||
372 | drive->io_32bit = saved_io_32bit; | ||
388 | } | 373 | } |
389 | 374 | ||
390 | static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, | 375 | static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, |
@@ -422,27 +407,22 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, | |||
422 | return ide_error(drive, s, stat); | 407 | return ide_error(drive, s, stat); |
423 | } | 408 | } |
424 | 409 | ||
425 | static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) | 410 | void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) |
426 | { | 411 | { |
427 | HWIF(drive)->cursg = NULL; | ||
428 | |||
429 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | 412 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
430 | ide_task_t *task = rq->special; | 413 | u8 err = drive->hwif->INB(IDE_ERROR_REG); |
431 | 414 | ||
432 | if (task->tf_flags & IDE_TFLAG_FLAGGED) { | 415 | ide_end_drive_cmd(drive, stat, err); |
433 | u8 err = drive->hwif->INB(IDE_ERROR_REG); | 416 | return; |
434 | ide_end_drive_cmd(drive, stat, err); | ||
435 | return; | ||
436 | } | ||
437 | } | 417 | } |
438 | 418 | ||
439 | if (rq->rq_disk) { | 419 | if (rq->rq_disk) { |
440 | ide_driver_t *drv; | 420 | ide_driver_t *drv; |
441 | 421 | ||
442 | drv = *(ide_driver_t **)rq->rq_disk->private_data;; | 422 | drv = *(ide_driver_t **)rq->rq_disk->private_data;; |
443 | drv->end_request(drive, 1, rq->hard_nr_sectors); | 423 | drv->end_request(drive, 1, rq->nr_sectors); |
444 | } else | 424 | } else |
445 | ide_end_request(drive, 1, rq->hard_nr_sectors); | 425 | ide_end_request(drive, 1, rq->nr_sectors); |
446 | } | 426 | } |
447 | 427 | ||
448 | /* | 428 | /* |
@@ -455,7 +435,7 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive) | |||
455 | u8 stat = hwif->INB(IDE_STATUS_REG); | 435 | u8 stat = hwif->INB(IDE_STATUS_REG); |
456 | 436 | ||
457 | /* new way for dealing with premature shared PCI interrupts */ | 437 | /* new way for dealing with premature shared PCI interrupts */ |
458 | if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) { | 438 | if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) { |
459 | if (stat & (ERR_STAT | DRQ_STAT)) | 439 | if (stat & (ERR_STAT | DRQ_STAT)) |
460 | return task_error(drive, rq, __FUNCTION__, stat); | 440 | return task_error(drive, rq, __FUNCTION__, stat); |
461 | /* No data yet, so wait for another IRQ. */ | 441 | /* No data yet, so wait for another IRQ. */ |
@@ -468,7 +448,7 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive) | |||
468 | /* If it was the last datablock check status and finish transfer. */ | 448 | /* If it was the last datablock check status and finish transfer. */ |
469 | if (!hwif->nleft) { | 449 | if (!hwif->nleft) { |
470 | stat = wait_drive_not_busy(drive); | 450 | stat = wait_drive_not_busy(drive); |
471 | if (!OK_STAT(stat, 0, BAD_R_STAT)) | 451 | if (!OK_STAT(stat, 0, BAD_STAT)) |
472 | return task_error(drive, rq, __FUNCTION__, stat); | 452 | return task_error(drive, rq, __FUNCTION__, stat); |
473 | task_end_request(drive, rq, stat); | 453 | task_end_request(drive, rq, stat); |
474 | return ide_stopped; | 454 | return ide_stopped; |
@@ -512,7 +492,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) | |||
512 | { | 492 | { |
513 | ide_startstop_t startstop; | 493 | ide_startstop_t startstop; |
514 | 494 | ||
515 | if (ide_wait_stat(&startstop, drive, DATA_READY, | 495 | if (ide_wait_stat(&startstop, drive, DRQ_STAT, |
516 | drive->bad_wstat, WAIT_DRQ)) { | 496 | drive->bad_wstat, WAIT_DRQ)) { |
517 | printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", | 497 | printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", |
518 | drive->name, | 498 | drive->name, |
@@ -580,7 +560,6 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
580 | unsigned int taskin = 0; | 560 | unsigned int taskin = 0; |
581 | unsigned int taskout = 0; | 561 | unsigned int taskout = 0; |
582 | u16 nsect = 0; | 562 | u16 nsect = 0; |
583 | u8 io_32bit = drive->io_32bit; | ||
584 | char __user *buf = (char __user *)arg; | 563 | char __user *buf = (char __user *)arg; |
585 | 564 | ||
586 | // printk("IDE Taskfile ...\n"); | 565 | // printk("IDE Taskfile ...\n"); |
@@ -633,9 +612,10 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
633 | 612 | ||
634 | args.data_phase = req_task->data_phase; | 613 | args.data_phase = req_task->data_phase; |
635 | 614 | ||
636 | args.tf_flags = IDE_TFLAG_OUT_DEVICE; | 615 | args.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | |
616 | IDE_TFLAG_IN_TF; | ||
637 | if (drive->addressing == 1) | 617 | if (drive->addressing == 1) |
638 | args.tf_flags |= IDE_TFLAG_LBA48; | 618 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); |
639 | 619 | ||
640 | if (req_task->out_flags.all) { | 620 | if (req_task->out_flags.all) { |
641 | args.tf_flags |= IDE_TFLAG_FLAGGED; | 621 | args.tf_flags |= IDE_TFLAG_FLAGGED; |
@@ -671,7 +651,6 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
671 | if (req_task->in_flags.b.data) | 651 | if (req_task->in_flags.b.data) |
672 | args.tf_flags |= IDE_TFLAG_IN_DATA; | 652 | args.tf_flags |= IDE_TFLAG_IN_DATA; |
673 | 653 | ||
674 | drive->io_32bit = 0; | ||
675 | switch(req_task->data_phase) { | 654 | switch(req_task->data_phase) { |
676 | case TASKFILE_MULTI_OUT: | 655 | case TASKFILE_MULTI_OUT: |
677 | if (!drive->mult_count) { | 656 | if (!drive->mult_count) { |
@@ -767,41 +746,24 @@ abort: | |||
767 | 746 | ||
768 | // printk("IDE Taskfile ioctl ended. rc = %i\n", err); | 747 | // printk("IDE Taskfile ioctl ended. rc = %i\n", err); |
769 | 748 | ||
770 | drive->io_32bit = io_32bit; | ||
771 | |||
772 | return err; | 749 | return err; |
773 | } | 750 | } |
774 | #endif | 751 | #endif |
775 | 752 | ||
776 | int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) | ||
777 | { | ||
778 | struct request rq; | ||
779 | u8 buffer[4]; | ||
780 | |||
781 | if (!buf) | ||
782 | buf = buffer; | ||
783 | memset(buf, 0, 4 + SECTOR_WORDS * 4 * sectors); | ||
784 | ide_init_drive_cmd(&rq); | ||
785 | rq.buffer = buf; | ||
786 | *buf++ = cmd; | ||
787 | *buf++ = nsect; | ||
788 | *buf++ = feature; | ||
789 | *buf++ = sectors; | ||
790 | return ide_do_drive_cmd(drive, &rq, ide_wait); | ||
791 | } | ||
792 | |||
793 | int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | 753 | int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) |
794 | { | 754 | { |
795 | int err = 0; | 755 | u8 *buf = NULL; |
796 | u8 args[4], *argbuf = args; | 756 | int bufsize = 0, err = 0; |
797 | u8 xfer_rate = 0; | 757 | u8 args[4], xfer_rate = 0; |
798 | int argsize = 4; | ||
799 | ide_task_t tfargs; | 758 | ide_task_t tfargs; |
800 | struct ide_taskfile *tf = &tfargs.tf; | 759 | struct ide_taskfile *tf = &tfargs.tf; |
801 | 760 | ||
802 | if (NULL == (void *) arg) { | 761 | if (NULL == (void *) arg) { |
803 | struct request rq; | 762 | struct request rq; |
763 | |||
804 | ide_init_drive_cmd(&rq); | 764 | ide_init_drive_cmd(&rq); |
765 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; | ||
766 | |||
805 | return ide_do_drive_cmd(drive, &rq, ide_wait); | 767 | return ide_do_drive_cmd(drive, &rq, ide_wait); |
806 | } | 768 | } |
807 | 769 | ||
@@ -810,23 +772,39 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
810 | 772 | ||
811 | memset(&tfargs, 0, sizeof(ide_task_t)); | 773 | memset(&tfargs, 0, sizeof(ide_task_t)); |
812 | tf->feature = args[2]; | 774 | tf->feature = args[2]; |
813 | tf->nsect = args[3]; | 775 | if (args[0] == WIN_SMART) { |
814 | tf->lbal = args[1]; | 776 | tf->nsect = args[3]; |
777 | tf->lbal = args[1]; | ||
778 | tf->lbam = 0x4f; | ||
779 | tf->lbah = 0xc2; | ||
780 | tfargs.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; | ||
781 | } else { | ||
782 | tf->nsect = args[1]; | ||
783 | tfargs.tf_flags = IDE_TFLAG_OUT_FEATURE | | ||
784 | IDE_TFLAG_OUT_NSECT | IDE_TFLAG_IN_NSECT; | ||
785 | } | ||
815 | tf->command = args[0]; | 786 | tf->command = args[0]; |
787 | tfargs.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA; | ||
816 | 788 | ||
817 | if (args[3]) { | 789 | if (args[3]) { |
818 | argsize = 4 + (SECTOR_WORDS * 4 * args[3]); | 790 | tfargs.tf_flags |= IDE_TFLAG_IO_16BIT; |
819 | argbuf = kzalloc(argsize, GFP_KERNEL); | 791 | bufsize = SECTOR_WORDS * 4 * args[3]; |
820 | if (argbuf == NULL) | 792 | buf = kzalloc(bufsize, GFP_KERNEL); |
793 | if (buf == NULL) | ||
821 | return -ENOMEM; | 794 | return -ENOMEM; |
822 | } | 795 | } |
796 | |||
823 | if (set_transfer(drive, &tfargs)) { | 797 | if (set_transfer(drive, &tfargs)) { |
824 | xfer_rate = args[1]; | 798 | xfer_rate = args[1]; |
825 | if (ide_ata66_check(drive, &tfargs)) | 799 | if (ide_ata66_check(drive, &tfargs)) |
826 | goto abort; | 800 | goto abort; |
827 | } | 801 | } |
828 | 802 | ||
829 | err = ide_wait_cmd(drive, args[0], args[1], args[2], args[3], argbuf); | 803 | err = ide_raw_taskfile(drive, &tfargs, buf, args[3]); |
804 | |||
805 | args[0] = tf->status; | ||
806 | args[1] = tf->error; | ||
807 | args[2] = tf->nsect; | ||
830 | 808 | ||
831 | if (!err && xfer_rate) { | 809 | if (!err && xfer_rate) { |
832 | /* active-retuning-calls future */ | 810 | /* active-retuning-calls future */ |
@@ -834,10 +812,13 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
834 | ide_driveid_update(drive); | 812 | ide_driveid_update(drive); |
835 | } | 813 | } |
836 | abort: | 814 | abort: |
837 | if (copy_to_user((void __user *)arg, argbuf, argsize)) | 815 | if (copy_to_user((void __user *)arg, &args, 4)) |
838 | err = -EFAULT; | 816 | err = -EFAULT; |
839 | if (argsize > 4) | 817 | if (buf) { |
840 | kfree(argbuf); | 818 | if (copy_to_user((void __user *)(arg + 4), buf, bufsize)) |
819 | err = -EFAULT; | ||
820 | kfree(buf); | ||
821 | } | ||
841 | return err; | 822 | return err; |
842 | } | 823 | } |
843 | 824 | ||
@@ -854,7 +835,7 @@ int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
854 | memset(&task, 0, sizeof(task)); | 835 | memset(&task, 0, sizeof(task)); |
855 | memcpy(&task.tf_array[7], &args[1], 6); | 836 | memcpy(&task.tf_array[7], &args[1], 6); |
856 | task.tf.command = args[0]; | 837 | task.tf.command = args[0]; |
857 | task.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 838 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
858 | 839 | ||
859 | err = ide_no_data_taskfile(drive, &task); | 840 | err = ide_no_data_taskfile(drive, &task); |
860 | 841 | ||
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index c6d4f630e18a..97894abd9ebc 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -95,7 +95,7 @@ DEFINE_MUTEX(ide_cfg_mtx); | |||
95 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock); | 95 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock); |
96 | 96 | ||
97 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | 97 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER |
98 | static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ | 98 | int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | int noautodma = 0; | 101 | int noautodma = 0; |
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(ide_hwifs); | |||
116 | /* | 116 | /* |
117 | * Do not even *think* about calling this! | 117 | * Do not even *think* about calling this! |
118 | */ | 118 | */ |
119 | static void init_hwif_data(ide_hwif_t *hwif, unsigned int index) | 119 | void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) |
120 | { | 120 | { |
121 | unsigned int unit; | 121 | unsigned int unit; |
122 | 122 | ||
@@ -159,6 +159,7 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index) | |||
159 | init_completion(&drive->gendev_rel_comp); | 159 | init_completion(&drive->gendev_rel_comp); |
160 | } | 160 | } |
161 | } | 161 | } |
162 | EXPORT_SYMBOL_GPL(ide_init_port_data); | ||
162 | 163 | ||
163 | static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) | 164 | static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) |
164 | { | 165 | { |
@@ -177,8 +178,6 @@ static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) | |||
177 | #endif | 178 | #endif |
178 | } | 179 | } |
179 | 180 | ||
180 | extern void ide_arm_init(void); | ||
181 | |||
182 | /* | 181 | /* |
183 | * init_ide_data() sets reasonable default values into all fields | 182 | * init_ide_data() sets reasonable default values into all fields |
184 | * of all instances of the hwifs and drives, but only on the first call. | 183 | * of all instances of the hwifs and drives, but only on the first call. |
@@ -210,16 +209,13 @@ static void __init init_ide_data (void) | |||
210 | /* Initialise all interface structures */ | 209 | /* Initialise all interface structures */ |
211 | for (index = 0; index < MAX_HWIFS; ++index) { | 210 | for (index = 0; index < MAX_HWIFS; ++index) { |
212 | hwif = &ide_hwifs[index]; | 211 | hwif = &ide_hwifs[index]; |
213 | init_hwif_data(hwif, index); | 212 | ide_init_port_data(hwif, index); |
214 | init_hwif_default(hwif, index); | 213 | init_hwif_default(hwif, index); |
215 | #if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) | 214 | #if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) |
216 | hwif->irq = | 215 | hwif->irq = |
217 | ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); | 216 | ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); |
218 | #endif | 217 | #endif |
219 | } | 218 | } |
220 | #ifdef CONFIG_IDE_ARM | ||
221 | ide_arm_init(); | ||
222 | #endif | ||
223 | } | 219 | } |
224 | 220 | ||
225 | /** | 221 | /** |
@@ -414,8 +410,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) | |||
414 | hwif->cds = tmp_hwif->cds; | 410 | hwif->cds = tmp_hwif->cds; |
415 | #endif | 411 | #endif |
416 | 412 | ||
417 | hwif->fixup = tmp_hwif->fixup; | ||
418 | |||
419 | hwif->set_pio_mode = tmp_hwif->set_pio_mode; | 413 | hwif->set_pio_mode = tmp_hwif->set_pio_mode; |
420 | hwif->set_dma_mode = tmp_hwif->set_dma_mode; | 414 | hwif->set_dma_mode = tmp_hwif->set_dma_mode; |
421 | hwif->mdma_filter = tmp_hwif->mdma_filter; | 415 | hwif->mdma_filter = tmp_hwif->mdma_filter; |
@@ -433,16 +427,13 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) | |||
433 | hwif->atapi_input_bytes = tmp_hwif->atapi_input_bytes; | 427 | hwif->atapi_input_bytes = tmp_hwif->atapi_input_bytes; |
434 | hwif->atapi_output_bytes = tmp_hwif->atapi_output_bytes; | 428 | hwif->atapi_output_bytes = tmp_hwif->atapi_output_bytes; |
435 | 429 | ||
430 | hwif->dma_host_set = tmp_hwif->dma_host_set; | ||
436 | hwif->dma_setup = tmp_hwif->dma_setup; | 431 | hwif->dma_setup = tmp_hwif->dma_setup; |
437 | hwif->dma_exec_cmd = tmp_hwif->dma_exec_cmd; | 432 | hwif->dma_exec_cmd = tmp_hwif->dma_exec_cmd; |
438 | hwif->dma_start = tmp_hwif->dma_start; | 433 | hwif->dma_start = tmp_hwif->dma_start; |
439 | hwif->ide_dma_end = tmp_hwif->ide_dma_end; | 434 | hwif->ide_dma_end = tmp_hwif->ide_dma_end; |
440 | hwif->ide_dma_on = tmp_hwif->ide_dma_on; | ||
441 | hwif->dma_off_quietly = tmp_hwif->dma_off_quietly; | ||
442 | hwif->ide_dma_test_irq = tmp_hwif->ide_dma_test_irq; | 435 | hwif->ide_dma_test_irq = tmp_hwif->ide_dma_test_irq; |
443 | hwif->ide_dma_clear_irq = tmp_hwif->ide_dma_clear_irq; | 436 | hwif->ide_dma_clear_irq = tmp_hwif->ide_dma_clear_irq; |
444 | hwif->dma_host_on = tmp_hwif->dma_host_on; | ||
445 | hwif->dma_host_off = tmp_hwif->dma_host_off; | ||
446 | hwif->dma_lost_irq = tmp_hwif->dma_lost_irq; | 437 | hwif->dma_lost_irq = tmp_hwif->dma_lost_irq; |
447 | hwif->dma_timeout = tmp_hwif->dma_timeout; | 438 | hwif->dma_timeout = tmp_hwif->dma_timeout; |
448 | 439 | ||
@@ -614,7 +605,7 @@ void ide_unregister(unsigned int index) | |||
614 | tmp_hwif = *hwif; | 605 | tmp_hwif = *hwif; |
615 | 606 | ||
616 | /* restore hwif data to pristine status */ | 607 | /* restore hwif data to pristine status */ |
617 | init_hwif_data(hwif, index); | 608 | ide_init_port_data(hwif, index); |
618 | init_hwif_default(hwif, index); | 609 | init_hwif_default(hwif, index); |
619 | 610 | ||
620 | ide_hwif_restore(hwif, &tmp_hwif); | 611 | ide_hwif_restore(hwif, &tmp_hwif); |
@@ -680,24 +671,34 @@ void ide_setup_ports ( hw_regs_t *hw, | |||
680 | */ | 671 | */ |
681 | } | 672 | } |
682 | 673 | ||
674 | void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) | ||
675 | { | ||
676 | memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); | ||
677 | hwif->irq = hw->irq; | ||
678 | hwif->noprobe = 0; | ||
679 | hwif->chipset = hw->chipset; | ||
680 | hwif->gendev.parent = hw->dev; | ||
681 | hwif->ack_intr = hw->ack_intr; | ||
682 | } | ||
683 | EXPORT_SYMBOL_GPL(ide_init_port_hw); | ||
684 | |||
683 | /** | 685 | /** |
684 | * ide_register_hw - register IDE interface | 686 | * ide_register_hw - register IDE interface |
685 | * @hw: hardware registers | 687 | * @hw: hardware registers |
686 | * @fixup: fixup function | 688 | * @quirkproc: quirkproc function |
687 | * @initializing: set while initializing built-in drivers | ||
688 | * @hwifp: pointer to returned hwif | 689 | * @hwifp: pointer to returned hwif |
689 | * | 690 | * |
690 | * Register an IDE interface, specifying exactly the registers etc. | 691 | * Register an IDE interface, specifying exactly the registers etc. |
691 | * Set init=1 iff calling before probes have taken place. | ||
692 | * | 692 | * |
693 | * Returns -1 on error. | 693 | * Returns -1 on error. |
694 | */ | 694 | */ |
695 | 695 | ||
696 | int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), | 696 | int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), |
697 | int initializing, ide_hwif_t **hwifp) | 697 | ide_hwif_t **hwifp) |
698 | { | 698 | { |
699 | int index, retry = 1; | 699 | int index, retry = 1; |
700 | ide_hwif_t *hwif; | 700 | ide_hwif_t *hwif; |
701 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
701 | 702 | ||
702 | do { | 703 | do { |
703 | for (index = 0; index < MAX_HWIFS; ++index) { | 704 | for (index = 0; index < MAX_HWIFS; ++index) { |
@@ -709,8 +710,7 @@ int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), | |||
709 | hwif = &ide_hwifs[index]; | 710 | hwif = &ide_hwifs[index]; |
710 | if (hwif->hold) | 711 | if (hwif->hold) |
711 | continue; | 712 | continue; |
712 | if ((!hwif->present && !hwif->mate && !initializing) || | 713 | if (!hwif->present && hwif->mate == NULL) |
713 | (!hwif->io_ports[IDE_DATA_OFFSET] && initializing)) | ||
714 | goto found; | 714 | goto found; |
715 | } | 715 | } |
716 | for (index = 0; index < MAX_HWIFS; index++) | 716 | for (index = 0; index < MAX_HWIFS; index++) |
@@ -721,29 +721,23 @@ found: | |||
721 | if (hwif->present) | 721 | if (hwif->present) |
722 | ide_unregister(index); | 722 | ide_unregister(index); |
723 | else if (!hwif->hold) { | 723 | else if (!hwif->hold) { |
724 | init_hwif_data(hwif, index); | 724 | ide_init_port_data(hwif, index); |
725 | init_hwif_default(hwif, index); | 725 | init_hwif_default(hwif, index); |
726 | } | 726 | } |
727 | if (hwif->present) | 727 | if (hwif->present) |
728 | return -1; | 728 | return -1; |
729 | memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); | ||
730 | hwif->irq = hw->irq; | ||
731 | hwif->noprobe = 0; | ||
732 | hwif->fixup = fixup; | ||
733 | hwif->chipset = hw->chipset; | ||
734 | hwif->gendev.parent = hw->dev; | ||
735 | hwif->ack_intr = hw->ack_intr; | ||
736 | 729 | ||
737 | if (initializing == 0) { | 730 | ide_init_port_hw(hwif, hw); |
738 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | 731 | hwif->quirkproc = quirkproc; |
739 | 732 | ||
740 | ide_device_add(idx); | 733 | idx[0] = index; |
741 | } | 734 | |
735 | ide_device_add(idx); | ||
742 | 736 | ||
743 | if (hwifp) | 737 | if (hwifp) |
744 | *hwifp = hwif; | 738 | *hwifp = hwif; |
745 | 739 | ||
746 | return (initializing || hwif->present) ? index : -1; | 740 | return hwif->present ? index : -1; |
747 | } | 741 | } |
748 | 742 | ||
749 | EXPORT_SYMBOL(ide_register_hw); | 743 | EXPORT_SYMBOL(ide_register_hw); |
@@ -836,7 +830,7 @@ int set_using_dma(ide_drive_t *drive, int arg) | |||
836 | if (!drive->id || !(drive->id->capability & 1)) | 830 | if (!drive->id || !(drive->id->capability & 1)) |
837 | goto out; | 831 | goto out; |
838 | 832 | ||
839 | if (hwif->ide_dma_on == NULL) | 833 | if (hwif->dma_host_set == NULL) |
840 | goto out; | 834 | goto out; |
841 | 835 | ||
842 | err = -EBUSY; | 836 | err = -EBUSY; |
@@ -884,7 +878,10 @@ int set_pio_mode(ide_drive_t *drive, int arg) | |||
884 | 878 | ||
885 | if (drive->special.b.set_tune) | 879 | if (drive->special.b.set_tune) |
886 | return -EBUSY; | 880 | return -EBUSY; |
881 | |||
887 | ide_init_drive_cmd(&rq); | 882 | ide_init_drive_cmd(&rq); |
883 | rq.cmd_type = REQ_TYPE_ATA_TASKFILE; | ||
884 | |||
888 | drive->tune_req = (u8) arg; | 885 | drive->tune_req = (u8) arg; |
889 | drive->special.b.set_tune = 1; | 886 | drive->special.b.set_tune = 1; |
890 | (void) ide_do_drive_cmd(drive, &rq, ide_wait); | 887 | (void) ide_do_drive_cmd(drive, &rq, ide_wait); |
@@ -1066,7 +1063,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device | |||
1066 | ide_init_hwif_ports(&hw, (unsigned long) args[0], | 1063 | ide_init_hwif_ports(&hw, (unsigned long) args[0], |
1067 | (unsigned long) args[1], NULL); | 1064 | (unsigned long) args[1], NULL); |
1068 | hw.irq = args[2]; | 1065 | hw.irq = args[2]; |
1069 | if (ide_register_hw(&hw, NULL, 0, NULL) == -1) | 1066 | if (ide_register_hw(&hw, NULL, NULL) == -1) |
1070 | return -EIO; | 1067 | return -EIO; |
1071 | return 0; | 1068 | return 0; |
1072 | } | 1069 | } |
@@ -1227,26 +1224,12 @@ static int __init match_parm (char *s, const char *keywords[], int vals[], int m | |||
1227 | return 0; /* zero = nothing matched */ | 1224 | return 0; /* zero = nothing matched */ |
1228 | } | 1225 | } |
1229 | 1226 | ||
1230 | #ifdef CONFIG_BLK_DEV_ALI14XX | ||
1231 | extern int probe_ali14xx; | 1227 | extern int probe_ali14xx; |
1232 | extern int ali14xx_init(void); | ||
1233 | #endif | ||
1234 | #ifdef CONFIG_BLK_DEV_UMC8672 | ||
1235 | extern int probe_umc8672; | 1228 | extern int probe_umc8672; |
1236 | extern int umc8672_init(void); | ||
1237 | #endif | ||
1238 | #ifdef CONFIG_BLK_DEV_DTC2278 | ||
1239 | extern int probe_dtc2278; | 1229 | extern int probe_dtc2278; |
1240 | extern int dtc2278_init(void); | ||
1241 | #endif | ||
1242 | #ifdef CONFIG_BLK_DEV_HT6560B | ||
1243 | extern int probe_ht6560b; | 1230 | extern int probe_ht6560b; |
1244 | extern int ht6560b_init(void); | ||
1245 | #endif | ||
1246 | #ifdef CONFIG_BLK_DEV_QD65XX | ||
1247 | extern int probe_qd65xx; | 1231 | extern int probe_qd65xx; |
1248 | extern int qd65xx_init(void); | 1232 | extern int cmd640_vlb; |
1249 | #endif | ||
1250 | 1233 | ||
1251 | static int __initdata is_chipset_set[MAX_HWIFS]; | 1234 | static int __initdata is_chipset_set[MAX_HWIFS]; |
1252 | 1235 | ||
@@ -1323,7 +1306,7 @@ static int __init ide_setup(char *s) | |||
1323 | if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) { | 1306 | if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) { |
1324 | const char *hd_words[] = { | 1307 | const char *hd_words[] = { |
1325 | "none", "noprobe", "nowerr", "cdrom", "nodma", | 1308 | "none", "noprobe", "nowerr", "cdrom", "nodma", |
1326 | "autotune", "noautotune", "minus8", "swapdata", "bswap", | 1309 | "autotune", "noautotune", "-8", "-9", "-10", |
1327 | "noflush", "remap", "remap63", "scsi", NULL }; | 1310 | "noflush", "remap", "remap63", "scsi", NULL }; |
1328 | unit = s[2] - 'a'; | 1311 | unit = s[2] - 'a'; |
1329 | hw = unit / MAX_DRIVES; | 1312 | hw = unit / MAX_DRIVES; |
@@ -1359,10 +1342,6 @@ static int __init ide_setup(char *s) | |||
1359 | case -7: /* "noautotune" */ | 1342 | case -7: /* "noautotune" */ |
1360 | drive->autotune = IDE_TUNE_NOAUTO; | 1343 | drive->autotune = IDE_TUNE_NOAUTO; |
1361 | goto obsolete_option; | 1344 | goto obsolete_option; |
1362 | case -9: /* "swapdata" */ | ||
1363 | case -10: /* "bswap" */ | ||
1364 | drive->bswap = 1; | ||
1365 | goto done; | ||
1366 | case -11: /* noflush */ | 1345 | case -11: /* noflush */ |
1367 | drive->noflush = 1; | 1346 | drive->noflush = 1; |
1368 | goto done; | 1347 | goto done; |
@@ -1462,11 +1441,8 @@ static int __init ide_setup(char *s) | |||
1462 | #endif | 1441 | #endif |
1463 | #ifdef CONFIG_BLK_DEV_CMD640 | 1442 | #ifdef CONFIG_BLK_DEV_CMD640 |
1464 | case -14: /* "cmd640_vlb" */ | 1443 | case -14: /* "cmd640_vlb" */ |
1465 | { | ||
1466 | extern int cmd640_vlb; /* flag for cmd640.c */ | ||
1467 | cmd640_vlb = 1; | 1444 | cmd640_vlb = 1; |
1468 | goto done; | 1445 | goto done; |
1469 | } | ||
1470 | #endif | 1446 | #endif |
1471 | #ifdef CONFIG_BLK_DEV_HT6560B | 1447 | #ifdef CONFIG_BLK_DEV_HT6560B |
1472 | case -13: /* "ht6560b" */ | 1448 | case -13: /* "ht6560b" */ |
@@ -1556,79 +1532,6 @@ done: | |||
1556 | return 1; | 1532 | return 1; |
1557 | } | 1533 | } |
1558 | 1534 | ||
1559 | extern void __init pnpide_init(void); | ||
1560 | extern void __exit pnpide_exit(void); | ||
1561 | extern void __init h8300_ide_init(void); | ||
1562 | |||
1563 | /* | ||
1564 | * probe_for_hwifs() finds/initializes "known" IDE interfaces | ||
1565 | */ | ||
1566 | static void __init probe_for_hwifs (void) | ||
1567 | { | ||
1568 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | ||
1569 | ide_scan_pcibus(ide_scan_direction); | ||
1570 | #endif | ||
1571 | |||
1572 | #ifdef CONFIG_ETRAX_IDE | ||
1573 | { | ||
1574 | extern void init_e100_ide(void); | ||
1575 | init_e100_ide(); | ||
1576 | } | ||
1577 | #endif /* CONFIG_ETRAX_IDE */ | ||
1578 | #ifdef CONFIG_BLK_DEV_CMD640 | ||
1579 | { | ||
1580 | extern void ide_probe_for_cmd640x(void); | ||
1581 | ide_probe_for_cmd640x(); | ||
1582 | } | ||
1583 | #endif /* CONFIG_BLK_DEV_CMD640 */ | ||
1584 | #ifdef CONFIG_BLK_DEV_IDE_PMAC | ||
1585 | { | ||
1586 | extern int pmac_ide_probe(void); | ||
1587 | (void)pmac_ide_probe(); | ||
1588 | } | ||
1589 | #endif /* CONFIG_BLK_DEV_IDE_PMAC */ | ||
1590 | #ifdef CONFIG_BLK_DEV_GAYLE | ||
1591 | { | ||
1592 | extern void gayle_init(void); | ||
1593 | gayle_init(); | ||
1594 | } | ||
1595 | #endif /* CONFIG_BLK_DEV_GAYLE */ | ||
1596 | #ifdef CONFIG_BLK_DEV_FALCON_IDE | ||
1597 | { | ||
1598 | extern void falconide_init(void); | ||
1599 | falconide_init(); | ||
1600 | } | ||
1601 | #endif /* CONFIG_BLK_DEV_FALCON_IDE */ | ||
1602 | #ifdef CONFIG_BLK_DEV_MAC_IDE | ||
1603 | { | ||
1604 | extern void macide_init(void); | ||
1605 | macide_init(); | ||
1606 | } | ||
1607 | #endif /* CONFIG_BLK_DEV_MAC_IDE */ | ||
1608 | #ifdef CONFIG_BLK_DEV_Q40IDE | ||
1609 | { | ||
1610 | extern void q40ide_init(void); | ||
1611 | q40ide_init(); | ||
1612 | } | ||
1613 | #endif /* CONFIG_BLK_DEV_Q40IDE */ | ||
1614 | #ifdef CONFIG_BLK_DEV_BUDDHA | ||
1615 | { | ||
1616 | extern void buddha_init(void); | ||
1617 | buddha_init(); | ||
1618 | } | ||
1619 | #endif /* CONFIG_BLK_DEV_BUDDHA */ | ||
1620 | #ifdef CONFIG_BLK_DEV_IDEPNP | ||
1621 | pnpide_init(); | ||
1622 | #endif | ||
1623 | #ifdef CONFIG_H8300 | ||
1624 | h8300_ide_init(); | ||
1625 | #endif | ||
1626 | } | ||
1627 | |||
1628 | /* | ||
1629 | * Probe module | ||
1630 | */ | ||
1631 | |||
1632 | EXPORT_SYMBOL(ide_lock); | 1535 | EXPORT_SYMBOL(ide_lock); |
1633 | 1536 | ||
1634 | static int ide_bus_match(struct device *dev, struct device_driver *drv) | 1537 | static int ide_bus_match(struct device *dev, struct device_driver *drv) |
@@ -1775,30 +1678,6 @@ static int __init ide_init(void) | |||
1775 | 1678 | ||
1776 | proc_ide_create(); | 1679 | proc_ide_create(); |
1777 | 1680 | ||
1778 | #ifdef CONFIG_BLK_DEV_ALI14XX | ||
1779 | if (probe_ali14xx) | ||
1780 | (void)ali14xx_init(); | ||
1781 | #endif | ||
1782 | #ifdef CONFIG_BLK_DEV_UMC8672 | ||
1783 | if (probe_umc8672) | ||
1784 | (void)umc8672_init(); | ||
1785 | #endif | ||
1786 | #ifdef CONFIG_BLK_DEV_DTC2278 | ||
1787 | if (probe_dtc2278) | ||
1788 | (void)dtc2278_init(); | ||
1789 | #endif | ||
1790 | #ifdef CONFIG_BLK_DEV_HT6560B | ||
1791 | if (probe_ht6560b) | ||
1792 | (void)ht6560b_init(); | ||
1793 | #endif | ||
1794 | #ifdef CONFIG_BLK_DEV_QD65XX | ||
1795 | if (probe_qd65xx) | ||
1796 | (void)qd65xx_init(); | ||
1797 | #endif | ||
1798 | |||
1799 | /* Probe for special PCI and other "known" interface chipsets. */ | ||
1800 | probe_for_hwifs(); | ||
1801 | |||
1802 | return 0; | 1681 | return 0; |
1803 | } | 1682 | } |
1804 | 1683 | ||
@@ -1834,10 +1713,6 @@ void __exit cleanup_module (void) | |||
1834 | for (index = 0; index < MAX_HWIFS; ++index) | 1713 | for (index = 0; index < MAX_HWIFS; ++index) |
1835 | ide_unregister(index); | 1714 | ide_unregister(index); |
1836 | 1715 | ||
1837 | #ifdef CONFIG_BLK_DEV_IDEPNP | ||
1838 | pnpide_exit(); | ||
1839 | #endif | ||
1840 | |||
1841 | proc_ide_destroy(); | 1716 | proc_ide_destroy(); |
1842 | 1717 | ||
1843 | bus_unregister(&ide_bus_type); | 1718 | bus_unregister(&ide_bus_type); |
diff --git a/drivers/ide/legacy/Makefile b/drivers/ide/legacy/Makefile index 409822349f10..7043ec7d1e05 100644 --- a/drivers/ide/legacy/Makefile +++ b/drivers/ide/legacy/Makefile | |||
@@ -1,15 +1,24 @@ | |||
1 | 1 | ||
2 | # link order is important here | ||
3 | |||
2 | obj-$(CONFIG_BLK_DEV_ALI14XX) += ali14xx.o | 4 | obj-$(CONFIG_BLK_DEV_ALI14XX) += ali14xx.o |
5 | obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o | ||
3 | obj-$(CONFIG_BLK_DEV_DTC2278) += dtc2278.o | 6 | obj-$(CONFIG_BLK_DEV_DTC2278) += dtc2278.o |
4 | obj-$(CONFIG_BLK_DEV_HT6560B) += ht6560b.o | 7 | obj-$(CONFIG_BLK_DEV_HT6560B) += ht6560b.o |
5 | obj-$(CONFIG_BLK_DEV_QD65XX) += qd65xx.o | 8 | obj-$(CONFIG_BLK_DEV_QD65XX) += qd65xx.o |
6 | obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o | ||
7 | 9 | ||
8 | obj-$(CONFIG_BLK_DEV_IDECS) += ide-cs.o | 10 | obj-$(CONFIG_BLK_DEV_GAYLE) += gayle.o |
11 | obj-$(CONFIG_BLK_DEV_FALCON_IDE) += falconide.o | ||
12 | obj-$(CONFIG_BLK_DEV_MAC_IDE) += macide.o | ||
13 | obj-$(CONFIG_BLK_DEV_Q40IDE) += q40ide.o | ||
14 | obj-$(CONFIG_BLK_DEV_BUDDHA) += buddha.o | ||
9 | 15 | ||
10 | obj-$(CONFIG_BLK_DEV_PLATFORM) += ide_platform.o | 16 | ifeq ($(CONFIG_BLK_DEV_IDECS), m) |
17 | obj-m += ide-cs.o | ||
18 | endif | ||
11 | 19 | ||
12 | # Last of all | 20 | ifeq ($(CONFIG_BLK_DEV_PLATFORM), m) |
13 | obj-$(CONFIG_BLK_DEV_HD) += hd.o | 21 | obj-m += ide_platform.o |
22 | endif | ||
14 | 23 | ||
15 | EXTRA_CFLAGS := -Idrivers/ide | 24 | EXTRA_CFLAGS := -Idrivers/ide |
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 38c3a6d63f30..5ec0be4cbad7 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
@@ -231,8 +231,7 @@ int probe_ali14xx = 0; | |||
231 | module_param_named(probe, probe_ali14xx, bool, 0); | 231 | module_param_named(probe, probe_ali14xx, bool, 0); |
232 | MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets"); | 232 | MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets"); |
233 | 233 | ||
234 | /* Can be called directly from ide.c. */ | 234 | static int __init ali14xx_init(void) |
235 | int __init ali14xx_init(void) | ||
236 | { | 235 | { |
237 | if (probe_ali14xx == 0) | 236 | if (probe_ali14xx == 0) |
238 | goto out; | 237 | goto out; |
@@ -248,9 +247,7 @@ out: | |||
248 | return -ENODEV; | 247 | return -ENODEV; |
249 | } | 248 | } |
250 | 249 | ||
251 | #ifdef MODULE | ||
252 | module_init(ali14xx_init); | 250 | module_init(ali14xx_init); |
253 | #endif | ||
254 | 251 | ||
255 | MODULE_AUTHOR("see local file"); | 252 | MODULE_AUTHOR("see local file"); |
256 | MODULE_DESCRIPTION("support of ALI 14XX IDE chipsets"); | 253 | MODULE_DESCRIPTION("support of ALI 14XX IDE chipsets"); |
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c index 4a0be251a05f..74d28e058f55 100644 --- a/drivers/ide/legacy/buddha.c +++ b/drivers/ide/legacy/buddha.c | |||
@@ -112,6 +112,7 @@ typedef enum BuddhaType_Enum { | |||
112 | BOARD_BUDDHA, BOARD_CATWEASEL, BOARD_XSURF | 112 | BOARD_BUDDHA, BOARD_CATWEASEL, BOARD_XSURF |
113 | } BuddhaType; | 113 | } BuddhaType; |
114 | 114 | ||
115 | static const char *buddha_board_name[] = { "Buddha", "Catweasel", "X-Surf" }; | ||
115 | 116 | ||
116 | /* | 117 | /* |
117 | * Check and acknowledge the interrupt status | 118 | * Check and acknowledge the interrupt status |
@@ -143,11 +144,11 @@ static int xsurf_ack_intr(ide_hwif_t *hwif) | |||
143 | * Probe for a Buddha or Catweasel IDE interface | 144 | * Probe for a Buddha or Catweasel IDE interface |
144 | */ | 145 | */ |
145 | 146 | ||
146 | void __init buddha_init(void) | 147 | static int __init buddha_init(void) |
147 | { | 148 | { |
148 | hw_regs_t hw; | 149 | hw_regs_t hw; |
149 | ide_hwif_t *hwif; | 150 | ide_hwif_t *hwif; |
150 | int i, index; | 151 | int i; |
151 | 152 | ||
152 | struct zorro_dev *z = NULL; | 153 | struct zorro_dev *z = NULL; |
153 | u_long buddha_board = 0; | 154 | u_long buddha_board = 0; |
@@ -156,6 +157,8 @@ void __init buddha_init(void) | |||
156 | 157 | ||
157 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { | 158 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { |
158 | unsigned long board; | 159 | unsigned long board; |
160 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
161 | |||
159 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { | 162 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { |
160 | buddha_num_hwifs = BUDDHA_NUM_HWIFS; | 163 | buddha_num_hwifs = BUDDHA_NUM_HWIFS; |
161 | type=BOARD_BUDDHA; | 164 | type=BOARD_BUDDHA; |
@@ -195,7 +198,10 @@ fail_base2: | |||
195 | /* X-Surf doesn't have this. IRQs are always on */ | 198 | /* X-Surf doesn't have this. IRQs are always on */ |
196 | if (type != BOARD_XSURF) | 199 | if (type != BOARD_XSURF) |
197 | z_writeb(0, buddha_board+BUDDHA_IRQ_MR); | 200 | z_writeb(0, buddha_board+BUDDHA_IRQ_MR); |
198 | 201 | ||
202 | printk(KERN_INFO "ide: %s IDE controller\n", | ||
203 | buddha_board_name[type]); | ||
204 | |||
199 | for(i=0;i<buddha_num_hwifs;i++) { | 205 | for(i=0;i<buddha_num_hwifs;i++) { |
200 | if(type != BOARD_XSURF) { | 206 | if(type != BOARD_XSURF) { |
201 | ide_setup_ports(&hw, (buddha_board+buddha_bases[i]), | 207 | ide_setup_ports(&hw, (buddha_board+buddha_bases[i]), |
@@ -213,23 +219,23 @@ fail_base2: | |||
213 | IRQ_AMIGA_PORTS); | 219 | IRQ_AMIGA_PORTS); |
214 | } | 220 | } |
215 | 221 | ||
216 | index = ide_register_hw(&hw, NULL, 1, &hwif); | 222 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
217 | if (index != -1) { | 223 | if (hwif) { |
224 | u8 index = hwif->index; | ||
225 | |||
226 | ide_init_port_data(hwif, index); | ||
227 | ide_init_port_hw(hwif, &hw); | ||
228 | |||
218 | hwif->mmio = 1; | 229 | hwif->mmio = 1; |
219 | printk("ide%d: ", index); | 230 | |
220 | switch(type) { | 231 | idx[i] = index; |
221 | case BOARD_BUDDHA: | 232 | } |
222 | printk("Buddha"); | ||
223 | break; | ||
224 | case BOARD_CATWEASEL: | ||
225 | printk("Catweasel"); | ||
226 | break; | ||
227 | case BOARD_XSURF: | ||
228 | printk("X-Surf"); | ||
229 | break; | ||
230 | } | ||
231 | printk(" IDE interface\n"); | ||
232 | } | ||
233 | } | 233 | } |
234 | |||
235 | ide_device_add(idx); | ||
234 | } | 236 | } |
237 | |||
238 | return 0; | ||
235 | } | 239 | } |
240 | |||
241 | module_init(buddha_init); | ||
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 24a845d45bd2..13eee6da2806 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c | |||
@@ -150,8 +150,7 @@ int probe_dtc2278 = 0; | |||
150 | module_param_named(probe, probe_dtc2278, bool, 0); | 150 | module_param_named(probe, probe_dtc2278, bool, 0); |
151 | MODULE_PARM_DESC(probe, "probe for DTC2278xx chipsets"); | 151 | MODULE_PARM_DESC(probe, "probe for DTC2278xx chipsets"); |
152 | 152 | ||
153 | /* Can be called directly from ide.c. */ | 153 | static int __init dtc2278_init(void) |
154 | int __init dtc2278_init(void) | ||
155 | { | 154 | { |
156 | if (probe_dtc2278 == 0) | 155 | if (probe_dtc2278 == 0) |
157 | return -ENODEV; | 156 | return -ENODEV; |
@@ -163,9 +162,7 @@ int __init dtc2278_init(void) | |||
163 | return 0; | 162 | return 0; |
164 | } | 163 | } |
165 | 164 | ||
166 | #ifdef MODULE | ||
167 | module_init(dtc2278_init); | 165 | module_init(dtc2278_init); |
168 | #endif | ||
169 | 166 | ||
170 | MODULE_AUTHOR("See Local File"); | 167 | MODULE_AUTHOR("See Local File"); |
171 | MODULE_DESCRIPTION("support of DTC-2278 VLB IDE chipsets"); | 168 | MODULE_DESCRIPTION("support of DTC-2278 VLB IDE chipsets"); |
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index 7d7936f1b900..2860956bdcb0 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c | |||
@@ -62,19 +62,31 @@ EXPORT_SYMBOL(falconide_intr_lock); | |||
62 | * Probe for a Falcon IDE interface | 62 | * Probe for a Falcon IDE interface |
63 | */ | 63 | */ |
64 | 64 | ||
65 | void __init falconide_init(void) | 65 | static int __init falconide_init(void) |
66 | { | 66 | { |
67 | if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) { | 67 | if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) { |
68 | hw_regs_t hw; | 68 | hw_regs_t hw; |
69 | int index; | 69 | |
70 | printk(KERN_INFO "ide: Falcon IDE controller\n"); | ||
70 | 71 | ||
71 | ide_setup_ports(&hw, ATA_HD_BASE, falconide_offsets, | 72 | ide_setup_ports(&hw, ATA_HD_BASE, falconide_offsets, |
72 | 0, 0, NULL, | 73 | 0, 0, NULL, |
73 | // falconide_iops, | 74 | // falconide_iops, |
74 | IRQ_MFP_IDE); | 75 | IRQ_MFP_IDE); |
75 | index = ide_register_hw(&hw, NULL, 1, NULL); | ||
76 | 76 | ||
77 | if (index != -1) | 77 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
78 | printk("ide%d: Falcon IDE interface\n", index); | 78 | if (hwif) { |
79 | u8 index = hwif->index; | ||
80 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | ||
81 | |||
82 | ide_init_port_data(hwif, index); | ||
83 | ide_init_port_hw(hwif, &hw); | ||
84 | |||
85 | ide_device_add(idx); | ||
86 | } | ||
79 | } | 87 | } |
88 | |||
89 | return 0; | ||
80 | } | 90 | } |
91 | |||
92 | module_init(falconide_init); | ||
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index 53331ee1e957..492fa047efc0 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c | |||
@@ -110,12 +110,13 @@ static int gayle_ack_intr_a1200(ide_hwif_t *hwif) | |||
110 | * Probe for a Gayle IDE interface (and optionally for an IDE doubler) | 110 | * Probe for a Gayle IDE interface (and optionally for an IDE doubler) |
111 | */ | 111 | */ |
112 | 112 | ||
113 | void __init gayle_init(void) | 113 | static int __init gayle_init(void) |
114 | { | 114 | { |
115 | int a4000, i; | 115 | int a4000, i; |
116 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
116 | 117 | ||
117 | if (!MACH_IS_AMIGA) | 118 | if (!MACH_IS_AMIGA) |
118 | return; | 119 | return -ENODEV; |
119 | 120 | ||
120 | if ((a4000 = AMIGAHW_PRESENT(A4000_IDE)) || AMIGAHW_PRESENT(A1200_IDE)) | 121 | if ((a4000 = AMIGAHW_PRESENT(A4000_IDE)) || AMIGAHW_PRESENT(A1200_IDE)) |
121 | goto found; | 122 | goto found; |
@@ -125,15 +126,21 @@ void __init gayle_init(void) | |||
125 | NULL)) | 126 | NULL)) |
126 | goto found; | 127 | goto found; |
127 | #endif | 128 | #endif |
128 | return; | 129 | return -ENODEV; |
129 | 130 | ||
130 | found: | 131 | found: |
132 | printk(KERN_INFO "ide: Gayle IDE controller (A%d style%s)\n", | ||
133 | a4000 ? 4000 : 1200, | ||
134 | #ifdef CONFIG_BLK_DEV_IDEDOUBLER | ||
135 | ide_doubler ? ", IDE doubler" : | ||
136 | #endif | ||
137 | ""); | ||
138 | |||
131 | for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) { | 139 | for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) { |
132 | unsigned long base, ctrlport, irqport; | 140 | unsigned long base, ctrlport, irqport; |
133 | ide_ack_intr_t *ack_intr; | 141 | ide_ack_intr_t *ack_intr; |
134 | hw_regs_t hw; | 142 | hw_regs_t hw; |
135 | ide_hwif_t *hwif; | 143 | ide_hwif_t *hwif; |
136 | int index; | ||
137 | unsigned long phys_base, res_start, res_n; | 144 | unsigned long phys_base, res_start, res_n; |
138 | 145 | ||
139 | if (a4000) { | 146 | if (a4000) { |
@@ -165,21 +172,23 @@ found: | |||
165 | // &gayle_iops, | 172 | // &gayle_iops, |
166 | IRQ_AMIGA_PORTS); | 173 | IRQ_AMIGA_PORTS); |
167 | 174 | ||
168 | index = ide_register_hw(&hw, NULL, 1, &hwif); | 175 | hwif = ide_find_port(base); |
169 | if (index != -1) { | 176 | if (hwif) { |
177 | u8 index = hwif->index; | ||
178 | |||
179 | ide_init_port_data(hwif, index); | ||
180 | ide_init_port_hw(hwif, &hw); | ||
181 | |||
170 | hwif->mmio = 1; | 182 | hwif->mmio = 1; |
171 | switch (i) { | 183 | |
172 | case 0: | 184 | idx[i] = index; |
173 | printk("ide%d: Gayle IDE interface (A%d style)\n", index, | ||
174 | a4000 ? 4000 : 1200); | ||
175 | break; | ||
176 | #ifdef CONFIG_BLK_DEV_IDEDOUBLER | ||
177 | case 1: | ||
178 | printk("ide%d: IDE doubler\n", index); | ||
179 | break; | ||
180 | #endif /* CONFIG_BLK_DEV_IDEDOUBLER */ | ||
181 | } | ||
182 | } else | 185 | } else |
183 | release_mem_region(res_start, res_n); | 186 | release_mem_region(res_start, res_n); |
184 | } | 187 | } |
188 | |||
189 | ide_device_add(idx); | ||
190 | |||
191 | return 0; | ||
185 | } | 192 | } |
193 | |||
194 | module_init(gayle_init); | ||
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index a4245d13f11b..8da5031a6d05 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
@@ -307,8 +307,7 @@ int probe_ht6560b = 0; | |||
307 | module_param_named(probe, probe_ht6560b, bool, 0); | 307 | module_param_named(probe, probe_ht6560b, bool, 0); |
308 | MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); | 308 | MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); |
309 | 309 | ||
310 | /* Can be called directly from ide.c. */ | 310 | static int __init ht6560b_init(void) |
311 | int __init ht6560b_init(void) | ||
312 | { | 311 | { |
313 | ide_hwif_t *hwif, *mate; | 312 | ide_hwif_t *hwif, *mate; |
314 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | 313 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; |
@@ -369,9 +368,7 @@ release_region: | |||
369 | return -ENODEV; | 368 | return -ENODEV; |
370 | } | 369 | } |
371 | 370 | ||
372 | #ifdef MODULE | ||
373 | module_init(ht6560b_init); | 371 | module_init(ht6560b_init); |
374 | #endif | ||
375 | 372 | ||
376 | MODULE_AUTHOR("See Local File"); | 373 | MODULE_AUTHOR("See Local File"); |
377 | MODULE_DESCRIPTION("HT-6560B EIDE-controller support"); | 374 | MODULE_DESCRIPTION("HT-6560B EIDE-controller support"); |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 03715c058664..f4ea15b32969 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -153,7 +153,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq | |||
153 | hw.irq = irq; | 153 | hw.irq = irq; |
154 | hw.chipset = ide_pci; | 154 | hw.chipset = ide_pci; |
155 | hw.dev = &handle->dev; | 155 | hw.dev = &handle->dev; |
156 | return ide_register_hw(&hw, &ide_undecoded_slave, 0, NULL); | 156 | return ide_register_hw(&hw, &ide_undecoded_slave, NULL); |
157 | } | 157 | } |
158 | 158 | ||
159 | /*====================================================================== | 159 | /*====================================================================== |
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 7bb79f53dac8..69a0fb0e564f 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -28,39 +28,27 @@ static struct { | |||
28 | int index; | 28 | int index; |
29 | } hwif_prop; | 29 | } hwif_prop; |
30 | 30 | ||
31 | static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, | 31 | static void __devinit plat_ide_setup_ports(hw_regs_t *hw, |
32 | void __iomem *ctrl, struct pata_platform_info *pdata, int irq, | 32 | void __iomem *base, |
33 | int mmio) | 33 | void __iomem *ctrl, |
34 | struct pata_platform_info *pdata, | ||
35 | int irq) | ||
34 | { | 36 | { |
35 | unsigned long port = (unsigned long)base; | 37 | unsigned long port = (unsigned long)base; |
36 | ide_hwif_t *hwif = ide_find_port(port); | ||
37 | int i; | 38 | int i; |
38 | 39 | ||
39 | if (hwif == NULL) | 40 | hw->io_ports[IDE_DATA_OFFSET] = port; |
40 | goto out; | ||
41 | |||
42 | hwif->io_ports[IDE_DATA_OFFSET] = port; | ||
43 | 41 | ||
44 | port += (1 << pdata->ioport_shift); | 42 | port += (1 << pdata->ioport_shift); |
45 | for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; | 43 | for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; |
46 | i++, port += (1 << pdata->ioport_shift)) | 44 | i++, port += (1 << pdata->ioport_shift)) |
47 | hwif->io_ports[i] = port; | 45 | hw->io_ports[i] = port; |
48 | |||
49 | hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; | ||
50 | 46 | ||
51 | hwif->irq = irq; | 47 | hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; |
52 | 48 | ||
53 | hwif->chipset = ide_generic; | 49 | hw->irq = irq; |
54 | 50 | ||
55 | if (mmio) { | 51 | hw->chipset = ide_generic; |
56 | hwif->mmio = 1; | ||
57 | default_hwif_mmiops(hwif); | ||
58 | } | ||
59 | |||
60 | hwif_prop.hwif = hwif; | ||
61 | hwif_prop.index = hwif->index; | ||
62 | out: | ||
63 | return hwif; | ||
64 | } | 52 | } |
65 | 53 | ||
66 | static int __devinit plat_ide_probe(struct platform_device *pdev) | 54 | static int __devinit plat_ide_probe(struct platform_device *pdev) |
@@ -71,6 +59,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
71 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 59 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
72 | int ret = 0; | 60 | int ret = 0; |
73 | int mmio = 0; | 61 | int mmio = 0; |
62 | hw_regs_t hw; | ||
74 | 63 | ||
75 | pdata = pdev->dev.platform_data; | 64 | pdata = pdev->dev.platform_data; |
76 | 65 | ||
@@ -106,15 +95,27 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
106 | res_alt->start, res_alt->end - res_alt->start + 1); | 95 | res_alt->start, res_alt->end - res_alt->start + 1); |
107 | } | 96 | } |
108 | 97 | ||
109 | hwif = plat_ide_locate_hwif(hwif_prop.plat_ide_mapbase, | 98 | hwif = ide_find_port((unsigned long)hwif_prop.plat_ide_mapbase); |
110 | hwif_prop.plat_ide_alt_mapbase, pdata, res_irq->start, mmio); | ||
111 | |||
112 | if (!hwif) { | 99 | if (!hwif) { |
113 | ret = -ENODEV; | 100 | ret = -ENODEV; |
114 | goto out; | 101 | goto out; |
115 | } | 102 | } |
116 | hwif->gendev.parent = &pdev->dev; | 103 | |
117 | hwif->noprobe = 0; | 104 | memset(&hw, 0, sizeof(hw)); |
105 | plat_ide_setup_ports(&hw, hwif_prop.plat_ide_mapbase, | ||
106 | hwif_prop.plat_ide_alt_mapbase, | ||
107 | pdata, res_irq->start); | ||
108 | hw.dev = &pdev->dev; | ||
109 | |||
110 | ide_init_port_hw(hwif, &hw); | ||
111 | |||
112 | if (mmio) { | ||
113 | hwif->mmio = 1; | ||
114 | default_hwif_mmiops(hwif); | ||
115 | } | ||
116 | |||
117 | hwif_prop.hwif = hwif; | ||
118 | hwif_prop.index = hwif->index; | ||
118 | 119 | ||
119 | idx[0] = hwif->index; | 120 | idx[0] = hwif->index; |
120 | 121 | ||
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index 5c6aa77c2370..782d4c76c0e5 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
@@ -77,15 +77,17 @@ int macide_ack_intr(ide_hwif_t* hwif) | |||
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
79 | 79 | ||
80 | static const char *mac_ide_name[] = | ||
81 | { "Quadra", "Powerbook", "Powerbook Baboon" }; | ||
82 | |||
80 | /* | 83 | /* |
81 | * Probe for a Macintosh IDE interface | 84 | * Probe for a Macintosh IDE interface |
82 | */ | 85 | */ |
83 | 86 | ||
84 | void __init macide_init(void) | 87 | static int __init macide_init(void) |
85 | { | 88 | { |
86 | hw_regs_t hw; | 89 | hw_regs_t hw; |
87 | ide_hwif_t *hwif; | 90 | ide_hwif_t *hwif; |
88 | int index = -1; | ||
89 | 91 | ||
90 | switch (macintosh_config->ide_type) { | 92 | switch (macintosh_config->ide_type) { |
91 | case MAC_IDE_QUADRA: | 93 | case MAC_IDE_QUADRA: |
@@ -93,48 +95,50 @@ void __init macide_init(void) | |||
93 | 0, 0, macide_ack_intr, | 95 | 0, 0, macide_ack_intr, |
94 | // quadra_ide_iops, | 96 | // quadra_ide_iops, |
95 | IRQ_NUBUS_F); | 97 | IRQ_NUBUS_F); |
96 | index = ide_register_hw(&hw, NULL, 1, &hwif); | ||
97 | break; | 98 | break; |
98 | case MAC_IDE_PB: | 99 | case MAC_IDE_PB: |
99 | ide_setup_ports(&hw, IDE_BASE, macide_offsets, | 100 | ide_setup_ports(&hw, IDE_BASE, macide_offsets, |
100 | 0, 0, macide_ack_intr, | 101 | 0, 0, macide_ack_intr, |
101 | // macide_pb_iops, | 102 | // macide_pb_iops, |
102 | IRQ_NUBUS_C); | 103 | IRQ_NUBUS_C); |
103 | index = ide_register_hw(&hw, NULL, 1, &hwif); | ||
104 | break; | 104 | break; |
105 | case MAC_IDE_BABOON: | 105 | case MAC_IDE_BABOON: |
106 | ide_setup_ports(&hw, BABOON_BASE, macide_offsets, | 106 | ide_setup_ports(&hw, BABOON_BASE, macide_offsets, |
107 | 0, 0, NULL, | 107 | 0, 0, NULL, |
108 | // macide_baboon_iops, | 108 | // macide_baboon_iops, |
109 | IRQ_BABOON_1); | 109 | IRQ_BABOON_1); |
110 | index = ide_register_hw(&hw, NULL, 1, &hwif); | 110 | break; |
111 | if (index == -1) break; | 111 | default: |
112 | if (macintosh_config->ident == MAC_MODEL_PB190) { | 112 | return -ENODEV; |
113 | } | ||
114 | |||
115 | printk(KERN_INFO "ide: Macintosh %s IDE controller\n", | ||
116 | mac_ide_name[macintosh_config->ide_type - 1]); | ||
113 | 117 | ||
118 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); | ||
119 | if (hwif) { | ||
120 | u8 index = hwif->index; | ||
121 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | ||
122 | |||
123 | ide_init_port_data(hwif, index); | ||
124 | ide_init_port_hw(hwif, &hw); | ||
125 | |||
126 | if (macintosh_config->ide_type == MAC_IDE_BABOON && | ||
127 | macintosh_config->ident == MAC_MODEL_PB190) { | ||
114 | /* Fix breakage in ide-disk.c: drive capacity */ | 128 | /* Fix breakage in ide-disk.c: drive capacity */ |
115 | /* is not initialized for drives without a */ | 129 | /* is not initialized for drives without a */ |
116 | /* hardware ID, and we can't get that without */ | 130 | /* hardware ID, and we can't get that without */ |
117 | /* probing the drive which freezes a 190. */ | 131 | /* probing the drive which freezes a 190. */ |
118 | 132 | ide_drive_t *drive = &hwif->drives[0]; | |
119 | ide_drive_t *drive = &ide_hwifs[index].drives[0]; | ||
120 | drive->capacity64 = drive->cyl*drive->head*drive->sect; | 133 | drive->capacity64 = drive->cyl*drive->head*drive->sect; |
121 | |||
122 | } | 134 | } |
123 | break; | ||
124 | |||
125 | default: | ||
126 | return; | ||
127 | } | ||
128 | 135 | ||
129 | if (index != -1) { | ||
130 | hwif->mmio = 1; | 136 | hwif->mmio = 1; |
131 | if (macintosh_config->ide_type == MAC_IDE_QUADRA) | 137 | |
132 | printk(KERN_INFO "ide%d: Macintosh Quadra IDE interface\n", index); | 138 | ide_device_add(idx); |
133 | else if (macintosh_config->ide_type == MAC_IDE_PB) | ||
134 | printk(KERN_INFO "ide%d: Macintosh Powerbook IDE interface\n", index); | ||
135 | else if (macintosh_config->ide_type == MAC_IDE_BABOON) | ||
136 | printk(KERN_INFO "ide%d: Macintosh Powerbook Baboon IDE interface\n", index); | ||
137 | else | ||
138 | printk(KERN_INFO "ide%d: Unknown Macintosh IDE interface\n", index); | ||
139 | } | 139 | } |
140 | |||
141 | return 0; | ||
140 | } | 142 | } |
143 | |||
144 | module_init(macide_init); | ||
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index 6ea46a6723e2..f5329730df99 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -111,15 +111,17 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={ | |||
111 | * Probe for Q40 IDE interfaces | 111 | * Probe for Q40 IDE interfaces |
112 | */ | 112 | */ |
113 | 113 | ||
114 | void __init q40ide_init(void) | 114 | static int __init q40ide_init(void) |
115 | { | 115 | { |
116 | int i; | 116 | int i; |
117 | ide_hwif_t *hwif; | 117 | ide_hwif_t *hwif; |
118 | int index; | ||
119 | const char *name; | 118 | const char *name; |
119 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
120 | 120 | ||
121 | if (!MACH_IS_Q40) | 121 | if (!MACH_IS_Q40) |
122 | return ; | 122 | return -ENODEV; |
123 | |||
124 | printk(KERN_INFO "ide: Q40 IDE controller\n"); | ||
123 | 125 | ||
124 | for (i = 0; i < Q40IDE_NUM_HWIFS; i++) { | 126 | for (i = 0; i < Q40IDE_NUM_HWIFS; i++) { |
125 | hw_regs_t hw; | 127 | hw_regs_t hw; |
@@ -141,10 +143,20 @@ void __init q40ide_init(void) | |||
141 | 0, NULL, | 143 | 0, NULL, |
142 | // m68kide_iops, | 144 | // m68kide_iops, |
143 | q40ide_default_irq(pcide_bases[i])); | 145 | q40ide_default_irq(pcide_bases[i])); |
144 | index = ide_register_hw(&hw, NULL, 1, &hwif); | 146 | |
145 | // **FIXME** | 147 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
146 | if (index != -1) | 148 | if (hwif) { |
149 | ide_init_port_data(hwif, hwif->index); | ||
150 | ide_init_port_hw(hwif, &hw); | ||
147 | hwif->mmio = 1; | 151 | hwif->mmio = 1; |
152 | |||
153 | idx[i] = hwif->index; | ||
154 | } | ||
148 | } | 155 | } |
156 | |||
157 | ide_device_add(idx); | ||
158 | |||
159 | return 0; | ||
149 | } | 160 | } |
150 | 161 | ||
162 | module_init(q40ide_init); | ||
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 912e73853faa..2bac4c1a6532 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -478,8 +478,7 @@ int probe_qd65xx = 0; | |||
478 | module_param_named(probe, probe_qd65xx, bool, 0); | 478 | module_param_named(probe, probe_qd65xx, bool, 0); |
479 | MODULE_PARM_DESC(probe, "probe for QD65xx chipsets"); | 479 | MODULE_PARM_DESC(probe, "probe for QD65xx chipsets"); |
480 | 480 | ||
481 | /* Can be called directly from ide.c. */ | 481 | static int __init qd65xx_init(void) |
482 | int __init qd65xx_init(void) | ||
483 | { | 482 | { |
484 | if (probe_qd65xx == 0) | 483 | if (probe_qd65xx == 0) |
485 | return -ENODEV; | 484 | return -ENODEV; |
@@ -492,9 +491,7 @@ int __init qd65xx_init(void) | |||
492 | return 0; | 491 | return 0; |
493 | } | 492 | } |
494 | 493 | ||
495 | #ifdef MODULE | ||
496 | module_init(qd65xx_init); | 494 | module_init(qd65xx_init); |
497 | #endif | ||
498 | 495 | ||
499 | MODULE_AUTHOR("Samuel Thibault"); | 496 | MODULE_AUTHOR("Samuel Thibault"); |
500 | MODULE_DESCRIPTION("support of qd65xx vlb ide chipset"); | 497 | MODULE_DESCRIPTION("support of qd65xx vlb ide chipset"); |
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index 79577b916874..a1ae1ae6699d 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c | |||
@@ -169,8 +169,7 @@ int probe_umc8672 = 0; | |||
169 | module_param_named(probe, probe_umc8672, bool, 0); | 169 | module_param_named(probe, probe_umc8672, bool, 0); |
170 | MODULE_PARM_DESC(probe, "probe for UMC8672 chipset"); | 170 | MODULE_PARM_DESC(probe, "probe for UMC8672 chipset"); |
171 | 171 | ||
172 | /* Can be called directly from ide.c. */ | 172 | static int __init umc8672_init(void) |
173 | int __init umc8672_init(void) | ||
174 | { | 173 | { |
175 | if (probe_umc8672 == 0) | 174 | if (probe_umc8672 == 0) |
176 | goto out; | 175 | goto out; |
@@ -181,9 +180,7 @@ out: | |||
181 | return -ENODEV;; | 180 | return -ENODEV;; |
182 | } | 181 | } |
183 | 182 | ||
184 | #ifdef MODULE | ||
185 | module_init(umc8672_init); | 183 | module_init(umc8672_init); |
186 | #endif | ||
187 | 184 | ||
188 | MODULE_AUTHOR("Wolfram Podien"); | 185 | MODULE_AUTHOR("Wolfram Podien"); |
189 | MODULE_DESCRIPTION("Support for UMC 8672 IDE chipset"); | 186 | MODULE_DESCRIPTION("Support for UMC 8672 IDE chipset"); |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index a4d0d4ca73d0..2d3e5115b834 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
@@ -395,26 +395,10 @@ static int auide_dma_test_irq(ide_drive_t *drive) | |||
395 | return 0; | 395 | return 0; |
396 | } | 396 | } |
397 | 397 | ||
398 | static void auide_dma_host_on(ide_drive_t *drive) | 398 | static void auide_dma_host_set(ide_drive_t *drive, int on) |
399 | { | 399 | { |
400 | } | 400 | } |
401 | 401 | ||
402 | static int auide_dma_on(ide_drive_t *drive) | ||
403 | { | ||
404 | drive->using_dma = 1; | ||
405 | |||
406 | return 0; | ||
407 | } | ||
408 | |||
409 | static void auide_dma_host_off(ide_drive_t *drive) | ||
410 | { | ||
411 | } | ||
412 | |||
413 | static void auide_dma_off_quietly(ide_drive_t *drive) | ||
414 | { | ||
415 | drive->using_dma = 0; | ||
416 | } | ||
417 | |||
418 | static void auide_dma_lost_irq(ide_drive_t *drive) | 402 | static void auide_dma_lost_irq(ide_drive_t *drive) |
419 | { | 403 | { |
420 | printk(KERN_ERR "%s: IRQ lost\n", drive->name); | 404 | printk(KERN_ERR "%s: IRQ lost\n", drive->name); |
@@ -641,12 +625,13 @@ static int au_ide_probe(struct device *dev) | |||
641 | /* FIXME: This might possibly break PCMCIA IDE devices */ | 625 | /* FIXME: This might possibly break PCMCIA IDE devices */ |
642 | 626 | ||
643 | hwif = &ide_hwifs[pdev->id]; | 627 | hwif = &ide_hwifs[pdev->id]; |
644 | hwif->irq = ahwif->irq; | ||
645 | hwif->chipset = ide_au1xxx; | ||
646 | 628 | ||
647 | memset(&hw, 0, sizeof(hw)); | 629 | memset(&hw, 0, sizeof(hw)); |
648 | auide_setup_ports(&hw, ahwif); | 630 | auide_setup_ports(&hw, ahwif); |
649 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); | 631 | hw.irq = ahwif->irq; |
632 | hw.chipset = ide_au1xxx; | ||
633 | |||
634 | ide_init_port_hw(hwif, &hw); | ||
650 | 635 | ||
651 | hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ | 636 | hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ |
652 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 637 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
@@ -660,7 +645,6 @@ static int au_ide_probe(struct device *dev) | |||
660 | hwif->pio_mask = ATA_PIO4; | 645 | hwif->pio_mask = ATA_PIO4; |
661 | hwif->host_flags = IDE_HFLAG_POST_SET_MODE; | 646 | hwif->host_flags = IDE_HFLAG_POST_SET_MODE; |
662 | 647 | ||
663 | hwif->noprobe = 0; | ||
664 | hwif->drives[0].unmask = 1; | 648 | hwif->drives[0].unmask = 1; |
665 | hwif->drives[1].unmask = 1; | 649 | hwif->drives[1].unmask = 1; |
666 | 650 | ||
@@ -682,29 +666,25 @@ static int au_ide_probe(struct device *dev) | |||
682 | hwif->set_dma_mode = &auide_set_dma_mode; | 666 | hwif->set_dma_mode = &auide_set_dma_mode; |
683 | 667 | ||
684 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 668 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
685 | hwif->dma_off_quietly = &auide_dma_off_quietly; | ||
686 | hwif->dma_timeout = &auide_dma_timeout; | 669 | hwif->dma_timeout = &auide_dma_timeout; |
687 | 670 | ||
688 | hwif->mdma_filter = &auide_mdma_filter; | 671 | hwif->mdma_filter = &auide_mdma_filter; |
689 | 672 | ||
673 | hwif->dma_host_set = &auide_dma_host_set; | ||
690 | hwif->dma_exec_cmd = &auide_dma_exec_cmd; | 674 | hwif->dma_exec_cmd = &auide_dma_exec_cmd; |
691 | hwif->dma_start = &auide_dma_start; | 675 | hwif->dma_start = &auide_dma_start; |
692 | hwif->ide_dma_end = &auide_dma_end; | 676 | hwif->ide_dma_end = &auide_dma_end; |
693 | hwif->dma_setup = &auide_dma_setup; | 677 | hwif->dma_setup = &auide_dma_setup; |
694 | hwif->ide_dma_test_irq = &auide_dma_test_irq; | 678 | hwif->ide_dma_test_irq = &auide_dma_test_irq; |
695 | hwif->dma_host_off = &auide_dma_host_off; | ||
696 | hwif->dma_host_on = &auide_dma_host_on; | ||
697 | hwif->dma_lost_irq = &auide_dma_lost_irq; | 679 | hwif->dma_lost_irq = &auide_dma_lost_irq; |
698 | hwif->ide_dma_on = &auide_dma_on; | 680 | #endif |
699 | #else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ | ||
700 | hwif->channel = 0; | 681 | hwif->channel = 0; |
701 | hwif->hold = 1; | ||
702 | hwif->select_data = 0; /* no chipset-specific code */ | 682 | hwif->select_data = 0; /* no chipset-specific code */ |
703 | hwif->config_data = 0; /* no chipset-specific code */ | 683 | hwif->config_data = 0; /* no chipset-specific code */ |
704 | 684 | ||
705 | hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ | 685 | hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ |
706 | hwif->drives[1].autotune = 1; | 686 | hwif->drives[1].autotune = 1; |
707 | #endif | 687 | |
708 | hwif->drives[0].no_io_32bit = 1; | 688 | hwif->drives[0].no_io_32bit = 1; |
709 | hwif->drives[1].no_io_32bit = 1; | 689 | hwif->drives[1].no_io_32bit = 1; |
710 | 690 | ||
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index 521edd41b572..8b3959dfa2b7 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c | |||
@@ -117,6 +117,7 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
117 | default_hwif_mmiops(hwif); | 117 | default_hwif_mmiops(hwif); |
118 | /* Prevent resource map manipulation. */ | 118 | /* Prevent resource map manipulation. */ |
119 | hwif->mmio = 1; | 119 | hwif->mmio = 1; |
120 | hwif->chipset = ide_generic; | ||
120 | hwif->noprobe = 0; | 121 | hwif->noprobe = 0; |
121 | 122 | ||
122 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) | 123 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) |
diff --git a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile index 95d1ea8f1f14..94803253e8af 100644 --- a/drivers/ide/pci/Makefile +++ b/drivers/ide/pci/Makefile | |||
@@ -36,4 +36,8 @@ obj-$(CONFIG_BLK_DEV_VIA82CXXX) += via82cxxx.o | |||
36 | # Must appear at the end of the block | 36 | # Must appear at the end of the block |
37 | obj-$(CONFIG_BLK_DEV_GENERIC) += generic.o | 37 | obj-$(CONFIG_BLK_DEV_GENERIC) += generic.o |
38 | 38 | ||
39 | ifeq ($(CONFIG_BLK_DEV_CMD640), m) | ||
40 | obj-m += cmd640.o | ||
41 | endif | ||
42 | |||
39 | EXTRA_CFLAGS := -Idrivers/ide | 43 | EXTRA_CFLAGS := -Idrivers/ide |
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 5ae26564fb72..491871984aaa 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/atiixp.c Version 0.03 Aug 3 2007 | 2 | * linux/drivers/ide/pci/atiixp.c Version 0.05 Nov 9 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2003 ATI Inc. <hyu@ati.com> | 4 | * Copyright (C) 2003 ATI Inc. <hyu@ati.com> |
5 | * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz | 5 | * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz |
@@ -43,47 +43,8 @@ static atiixp_ide_timing mdma_timing[] = { | |||
43 | { 0x02, 0x00 }, | 43 | { 0x02, 0x00 }, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | static int save_mdma_mode[4]; | ||
47 | |||
48 | static DEFINE_SPINLOCK(atiixp_lock); | 46 | static DEFINE_SPINLOCK(atiixp_lock); |
49 | 47 | ||
50 | static void atiixp_dma_host_on(ide_drive_t *drive) | ||
51 | { | ||
52 | struct pci_dev *dev = drive->hwif->pci_dev; | ||
53 | unsigned long flags; | ||
54 | u16 tmp16; | ||
55 | |||
56 | spin_lock_irqsave(&atiixp_lock, flags); | ||
57 | |||
58 | pci_read_config_word(dev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); | ||
59 | if (save_mdma_mode[drive->dn]) | ||
60 | tmp16 &= ~(1 << drive->dn); | ||
61 | else | ||
62 | tmp16 |= (1 << drive->dn); | ||
63 | pci_write_config_word(dev, ATIIXP_IDE_UDMA_CONTROL, tmp16); | ||
64 | |||
65 | spin_unlock_irqrestore(&atiixp_lock, flags); | ||
66 | |||
67 | ide_dma_host_on(drive); | ||
68 | } | ||
69 | |||
70 | static void atiixp_dma_host_off(ide_drive_t *drive) | ||
71 | { | ||
72 | struct pci_dev *dev = drive->hwif->pci_dev; | ||
73 | unsigned long flags; | ||
74 | u16 tmp16; | ||
75 | |||
76 | spin_lock_irqsave(&atiixp_lock, flags); | ||
77 | |||
78 | pci_read_config_word(dev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); | ||
79 | tmp16 &= ~(1 << drive->dn); | ||
80 | pci_write_config_word(dev, ATIIXP_IDE_UDMA_CONTROL, tmp16); | ||
81 | |||
82 | spin_unlock_irqrestore(&atiixp_lock, flags); | ||
83 | |||
84 | ide_dma_host_off(drive); | ||
85 | } | ||
86 | |||
87 | /** | 48 | /** |
88 | * atiixp_set_pio_mode - set host controller for PIO mode | 49 | * atiixp_set_pio_mode - set host controller for PIO mode |
89 | * @drive: drive | 50 | * @drive: drive |
@@ -132,26 +93,33 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
132 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | 93 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; |
133 | u32 tmp32; | 94 | u32 tmp32; |
134 | u16 tmp16; | 95 | u16 tmp16; |
96 | u16 udma_ctl = 0; | ||
135 | 97 | ||
136 | spin_lock_irqsave(&atiixp_lock, flags); | 98 | spin_lock_irqsave(&atiixp_lock, flags); |
137 | 99 | ||
138 | save_mdma_mode[drive->dn] = 0; | 100 | pci_read_config_word(dev, ATIIXP_IDE_UDMA_CONTROL, &udma_ctl); |
101 | |||
139 | if (speed >= XFER_UDMA_0) { | 102 | if (speed >= XFER_UDMA_0) { |
140 | pci_read_config_word(dev, ATIIXP_IDE_UDMA_MODE, &tmp16); | 103 | pci_read_config_word(dev, ATIIXP_IDE_UDMA_MODE, &tmp16); |
141 | tmp16 &= ~(0x07 << (drive->dn * 4)); | 104 | tmp16 &= ~(0x07 << (drive->dn * 4)); |
142 | tmp16 |= ((speed & 0x07) << (drive->dn * 4)); | 105 | tmp16 |= ((speed & 0x07) << (drive->dn * 4)); |
143 | pci_write_config_word(dev, ATIIXP_IDE_UDMA_MODE, tmp16); | 106 | pci_write_config_word(dev, ATIIXP_IDE_UDMA_MODE, tmp16); |
144 | } else { | 107 | |
145 | if ((speed >= XFER_MW_DMA_0) && (speed <= XFER_MW_DMA_2)) { | 108 | udma_ctl |= (1 << drive->dn); |
146 | save_mdma_mode[drive->dn] = speed; | 109 | } else if (speed >= XFER_MW_DMA_0) { |
147 | pci_read_config_dword(dev, ATIIXP_IDE_MDMA_TIMING, &tmp32); | 110 | u8 i = speed & 0x03; |
148 | tmp32 &= ~(0xff << timing_shift); | 111 | |
149 | tmp32 |= (mdma_timing[speed & 0x03].recover_width << timing_shift) | | 112 | pci_read_config_dword(dev, ATIIXP_IDE_MDMA_TIMING, &tmp32); |
150 | (mdma_timing[speed & 0x03].command_width << (timing_shift + 4)); | 113 | tmp32 &= ~(0xff << timing_shift); |
151 | pci_write_config_dword(dev, ATIIXP_IDE_MDMA_TIMING, tmp32); | 114 | tmp32 |= (mdma_timing[i].recover_width << timing_shift) | |
152 | } | 115 | (mdma_timing[i].command_width << (timing_shift + 4)); |
116 | pci_write_config_dword(dev, ATIIXP_IDE_MDMA_TIMING, tmp32); | ||
117 | |||
118 | udma_ctl &= ~(1 << drive->dn); | ||
153 | } | 119 | } |
154 | 120 | ||
121 | pci_write_config_word(dev, ATIIXP_IDE_UDMA_CONTROL, udma_ctl); | ||
122 | |||
155 | spin_unlock_irqrestore(&atiixp_lock, flags); | 123 | spin_unlock_irqrestore(&atiixp_lock, flags); |
156 | } | 124 | } |
157 | 125 | ||
@@ -181,9 +149,6 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) | |||
181 | hwif->cbl = ATA_CBL_PATA80; | 149 | hwif->cbl = ATA_CBL_PATA80; |
182 | else | 150 | else |
183 | hwif->cbl = ATA_CBL_PATA40; | 151 | hwif->cbl = ATA_CBL_PATA40; |
184 | |||
185 | hwif->dma_host_on = &atiixp_dma_host_on; | ||
186 | hwif->dma_host_off = &atiixp_dma_host_off; | ||
187 | } | 152 | } |
188 | 153 | ||
189 | static const struct ide_port_info atiixp_pci_info[] __devinitdata = { | 154 | static const struct ide_port_info atiixp_pci_info[] __devinitdata = { |
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 4aa48104e0c1..da3565e0071f 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -706,9 +706,9 @@ static int pci_conf2(void) | |||
706 | } | 706 | } |
707 | 707 | ||
708 | /* | 708 | /* |
709 | * Probe for a cmd640 chipset, and initialize it if found. Called from ide.c | 709 | * Probe for a cmd640 chipset, and initialize it if found. |
710 | */ | 710 | */ |
711 | int __init ide_probe_for_cmd640x (void) | 711 | static int __init cmd640x_init(void) |
712 | { | 712 | { |
713 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 713 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
714 | int second_port_toggled = 0; | 714 | int second_port_toggled = 0; |
@@ -717,6 +717,7 @@ int __init ide_probe_for_cmd640x (void) | |||
717 | const char *bus_type, *port2; | 717 | const char *bus_type, *port2; |
718 | unsigned int index; | 718 | unsigned int index; |
719 | u8 b, cfr; | 719 | u8 b, cfr; |
720 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
720 | 721 | ||
721 | if (cmd640_vlb && probe_for_cmd640_vlb()) { | 722 | if (cmd640_vlb && probe_for_cmd640_vlb()) { |
722 | bus_type = "VLB"; | 723 | bus_type = "VLB"; |
@@ -769,6 +770,8 @@ int __init ide_probe_for_cmd640x (void) | |||
769 | cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; | 770 | cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; |
770 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 771 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
771 | 772 | ||
773 | idx[0] = cmd_hwif0->index; | ||
774 | |||
772 | /* | 775 | /* |
773 | * Ensure compatibility by always using the slowest timings | 776 | * Ensure compatibility by always using the slowest timings |
774 | * for access to the drive's command register block, | 777 | * for access to the drive's command register block, |
@@ -826,6 +829,8 @@ int __init ide_probe_for_cmd640x (void) | |||
826 | cmd_hwif1->pio_mask = ATA_PIO5; | 829 | cmd_hwif1->pio_mask = ATA_PIO5; |
827 | cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; | 830 | cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; |
828 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 831 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
832 | |||
833 | idx[1] = cmd_hwif1->index; | ||
829 | } | 834 | } |
830 | printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name, | 835 | printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name, |
831 | cmd_hwif0->serialized ? "" : "not ", port2); | 836 | cmd_hwif0->serialized ? "" : "not ", port2); |
@@ -872,6 +877,13 @@ int __init ide_probe_for_cmd640x (void) | |||
872 | #ifdef CMD640_DUMP_REGS | 877 | #ifdef CMD640_DUMP_REGS |
873 | cmd640_dump_regs(); | 878 | cmd640_dump_regs(); |
874 | #endif | 879 | #endif |
880 | |||
881 | ide_device_add(idx); | ||
882 | |||
875 | return 1; | 883 | return 1; |
876 | } | 884 | } |
877 | 885 | ||
886 | module_param_named(probe_vlb, cmd640_vlb, bool, 0); | ||
887 | MODULE_PARM_DESC(probe_vlb, "probe for VLB version of CMD640 chipset"); | ||
888 | |||
889 | module_init(cmd640x_init); | ||
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 0b1e9479f019..cd4eb9def151 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cmd64x.c Version 1.52 Dec 24, 2007 | 2 | * linux/drivers/ide/pci/cmd64x.c Version 1.53 Dec 24, 2007 |
3 | * | 3 | * |
4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. | 4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. |
5 | * Due to massive hardware bugs, UltraDMA is only supported | 5 | * Due to massive hardware bugs, UltraDMA is only supported |
@@ -22,8 +22,6 @@ | |||
22 | 22 | ||
23 | #include <asm/io.h> | 23 | #include <asm/io.h> |
24 | 24 | ||
25 | #define DISPLAY_CMD64X_TIMINGS | ||
26 | |||
27 | #define CMD_DEBUG 0 | 25 | #define CMD_DEBUG 0 |
28 | 26 | ||
29 | #if CMD_DEBUG | 27 | #if CMD_DEBUG |
@@ -37,11 +35,6 @@ | |||
37 | */ | 35 | */ |
38 | #define CFR 0x50 | 36 | #define CFR 0x50 |
39 | #define CFR_INTR_CH0 0x04 | 37 | #define CFR_INTR_CH0 0x04 |
40 | #define CNTRL 0x51 | ||
41 | #define CNTRL_ENA_1ST 0x04 | ||
42 | #define CNTRL_ENA_2ND 0x08 | ||
43 | #define CNTRL_DIS_RA0 0x40 | ||
44 | #define CNTRL_DIS_RA1 0x80 | ||
45 | 38 | ||
46 | #define CMDTIM 0x52 | 39 | #define CMDTIM 0x52 |
47 | #define ARTTIM0 0x53 | 40 | #define ARTTIM0 0x53 |
@@ -60,108 +53,13 @@ | |||
60 | #define MRDMODE 0x71 | 53 | #define MRDMODE 0x71 |
61 | #define MRDMODE_INTR_CH0 0x04 | 54 | #define MRDMODE_INTR_CH0 0x04 |
62 | #define MRDMODE_INTR_CH1 0x08 | 55 | #define MRDMODE_INTR_CH1 0x08 |
63 | #define MRDMODE_BLK_CH0 0x10 | ||
64 | #define MRDMODE_BLK_CH1 0x20 | ||
65 | #define BMIDESR0 0x72 | ||
66 | #define UDIDETCR0 0x73 | 56 | #define UDIDETCR0 0x73 |
67 | #define DTPR0 0x74 | 57 | #define DTPR0 0x74 |
68 | #define BMIDECR1 0x78 | 58 | #define BMIDECR1 0x78 |
69 | #define BMIDECSR 0x79 | 59 | #define BMIDECSR 0x79 |
70 | #define BMIDESR1 0x7A | ||
71 | #define UDIDETCR1 0x7B | 60 | #define UDIDETCR1 0x7B |
72 | #define DTPR1 0x7C | 61 | #define DTPR1 0x7C |
73 | 62 | ||
74 | #if defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_IDE_PROC_FS) | ||
75 | #include <linux/stat.h> | ||
76 | #include <linux/proc_fs.h> | ||
77 | |||
78 | static u8 cmd64x_proc = 0; | ||
79 | |||
80 | #define CMD_MAX_DEVS 5 | ||
81 | |||
82 | static struct pci_dev *cmd_devs[CMD_MAX_DEVS]; | ||
83 | static int n_cmd_devs; | ||
84 | |||
85 | static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index) | ||
86 | { | ||
87 | char *p = buf; | ||
88 | u8 reg72 = 0, reg73 = 0; /* primary */ | ||
89 | u8 reg7a = 0, reg7b = 0; /* secondary */ | ||
90 | u8 reg50 = 1, reg51 = 1, reg57 = 0, reg71 = 0; /* extra */ | ||
91 | |||
92 | p += sprintf(p, "\nController: %d\n", index); | ||
93 | p += sprintf(p, "PCI-%x Chipset.\n", dev->device); | ||
94 | |||
95 | (void) pci_read_config_byte(dev, CFR, ®50); | ||
96 | (void) pci_read_config_byte(dev, CNTRL, ®51); | ||
97 | (void) pci_read_config_byte(dev, ARTTIM23, ®57); | ||
98 | (void) pci_read_config_byte(dev, MRDMODE, ®71); | ||
99 | (void) pci_read_config_byte(dev, BMIDESR0, ®72); | ||
100 | (void) pci_read_config_byte(dev, UDIDETCR0, ®73); | ||
101 | (void) pci_read_config_byte(dev, BMIDESR1, ®7a); | ||
102 | (void) pci_read_config_byte(dev, UDIDETCR1, ®7b); | ||
103 | |||
104 | /* PCI0643/6 originally didn't have the primary channel enable bit */ | ||
105 | if ((dev->device == PCI_DEVICE_ID_CMD_643) || | ||
106 | (dev->device == PCI_DEVICE_ID_CMD_646 && dev->revision < 3)) | ||
107 | reg51 |= CNTRL_ENA_1ST; | ||
108 | |||
109 | p += sprintf(p, "---------------- Primary Channel " | ||
110 | "---------------- Secondary Channel ------------\n"); | ||
111 | p += sprintf(p, " %s %s\n", | ||
112 | (reg51 & CNTRL_ENA_1ST) ? "enabled " : "disabled", | ||
113 | (reg51 & CNTRL_ENA_2ND) ? "enabled " : "disabled"); | ||
114 | p += sprintf(p, "---------------- drive0 --------- drive1 " | ||
115 | "-------- drive0 --------- drive1 ------\n"); | ||
116 | p += sprintf(p, "DMA enabled: %s %s" | ||
117 | " %s %s\n", | ||
118 | (reg72 & 0x20) ? "yes" : "no ", (reg72 & 0x40) ? "yes" : "no ", | ||
119 | (reg7a & 0x20) ? "yes" : "no ", (reg7a & 0x40) ? "yes" : "no "); | ||
120 | p += sprintf(p, "UltraDMA mode: %s (%c) %s (%c)", | ||
121 | ( reg73 & 0x01) ? " on" : "off", | ||
122 | ((reg73 & 0x30) == 0x30) ? ((reg73 & 0x04) ? '3' : '0') : | ||
123 | ((reg73 & 0x30) == 0x20) ? ((reg73 & 0x04) ? '3' : '1') : | ||
124 | ((reg73 & 0x30) == 0x10) ? ((reg73 & 0x04) ? '4' : '2') : | ||
125 | ((reg73 & 0x30) == 0x00) ? ((reg73 & 0x04) ? '5' : '2') : '?', | ||
126 | ( reg73 & 0x02) ? " on" : "off", | ||
127 | ((reg73 & 0xC0) == 0xC0) ? ((reg73 & 0x08) ? '3' : '0') : | ||
128 | ((reg73 & 0xC0) == 0x80) ? ((reg73 & 0x08) ? '3' : '1') : | ||
129 | ((reg73 & 0xC0) == 0x40) ? ((reg73 & 0x08) ? '4' : '2') : | ||
130 | ((reg73 & 0xC0) == 0x00) ? ((reg73 & 0x08) ? '5' : '2') : '?'); | ||
131 | p += sprintf(p, " %s (%c) %s (%c)\n", | ||
132 | ( reg7b & 0x01) ? " on" : "off", | ||
133 | ((reg7b & 0x30) == 0x30) ? ((reg7b & 0x04) ? '3' : '0') : | ||
134 | ((reg7b & 0x30) == 0x20) ? ((reg7b & 0x04) ? '3' : '1') : | ||
135 | ((reg7b & 0x30) == 0x10) ? ((reg7b & 0x04) ? '4' : '2') : | ||
136 | ((reg7b & 0x30) == 0x00) ? ((reg7b & 0x04) ? '5' : '2') : '?', | ||
137 | ( reg7b & 0x02) ? " on" : "off", | ||
138 | ((reg7b & 0xC0) == 0xC0) ? ((reg7b & 0x08) ? '3' : '0') : | ||
139 | ((reg7b & 0xC0) == 0x80) ? ((reg7b & 0x08) ? '3' : '1') : | ||
140 | ((reg7b & 0xC0) == 0x40) ? ((reg7b & 0x08) ? '4' : '2') : | ||
141 | ((reg7b & 0xC0) == 0x00) ? ((reg7b & 0x08) ? '5' : '2') : '?'); | ||
142 | p += sprintf(p, "Interrupt: %s, %s %s, %s\n", | ||
143 | (reg71 & MRDMODE_BLK_CH0 ) ? "blocked" : "enabled", | ||
144 | (reg50 & CFR_INTR_CH0 ) ? "pending" : "clear ", | ||
145 | (reg71 & MRDMODE_BLK_CH1 ) ? "blocked" : "enabled", | ||
146 | (reg57 & ARTTIM23_INTR_CH1) ? "pending" : "clear "); | ||
147 | |||
148 | return (char *)p; | ||
149 | } | ||
150 | |||
151 | static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count) | ||
152 | { | ||
153 | char *p = buffer; | ||
154 | int i; | ||
155 | |||
156 | for (i = 0; i < n_cmd_devs; i++) { | ||
157 | struct pci_dev *dev = cmd_devs[i]; | ||
158 | p = print_cmd64x_get_info(p, dev, i); | ||
159 | } | ||
160 | return p-buffer; /* => must be less than 4k! */ | ||
161 | } | ||
162 | |||
163 | #endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_IDE_PROC_FS) */ | ||
164 | |||
165 | static u8 quantize_timing(int timing, int quant) | 63 | static u8 quantize_timing(int timing, int quant) |
166 | { | 64 | { |
167 | return (timing + quant - 1) / quant; | 65 | return (timing + quant - 1) / quant; |
@@ -472,16 +370,6 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha | |||
472 | mrdmode &= ~0x30; | 370 | mrdmode &= ~0x30; |
473 | (void) pci_write_config_byte(dev, MRDMODE, (mrdmode | 0x02)); | 371 | (void) pci_write_config_byte(dev, MRDMODE, (mrdmode | 0x02)); |
474 | 372 | ||
475 | #if defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_IDE_PROC_FS) | ||
476 | |||
477 | cmd_devs[n_cmd_devs++] = dev; | ||
478 | |||
479 | if (!cmd64x_proc) { | ||
480 | cmd64x_proc = 1; | ||
481 | ide_pci_create_host_proc("cmd64x", cmd64x_get_info); | ||
482 | } | ||
483 | #endif /* DISPLAY_CMD64X_TIMINGS && CONFIG_IDE_PROC_FS */ | ||
484 | |||
485 | return 0; | 373 | return 0; |
486 | } | 374 | } |
487 | 375 | ||
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index d1a91bcb5b29..6ec00b8d7ec1 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -71,7 +71,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
71 | ide_hwif_t *hwif = HWIF(drive); | 71 | ide_hwif_t *hwif = HWIF(drive); |
72 | struct pci_dev *pdev = hwif->pci_dev; | 72 | struct pci_dev *pdev = hwif->pci_dev; |
73 | int controller = drive->dn > 1 ? 1 : 0; | 73 | int controller = drive->dn > 1 ? 1 : 0; |
74 | u8 reg; | ||
75 | 74 | ||
76 | /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ | 75 | /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ |
77 | 76 | ||
@@ -91,11 +90,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
91 | pci_write_config_byte(pdev, 0x66 + 4*controller + (drive->dn&1), | 90 | pci_write_config_byte(pdev, 0x66 + 4*controller + (drive->dn&1), |
92 | (cs5520_pio_clocks[pio].recovery << 4) | | 91 | (cs5520_pio_clocks[pio].recovery << 4) | |
93 | (cs5520_pio_clocks[pio].assert)); | 92 | (cs5520_pio_clocks[pio].assert)); |
94 | |||
95 | /* Set the DMA enable/disable flag */ | ||
96 | reg = inb(hwif->dma_base + 0x02 + 8*controller); | ||
97 | reg |= 1<<((drive->dn&1)+5); | ||
98 | outb(reg, hwif->dma_base + 0x02 + 8*controller); | ||
99 | } | 93 | } |
100 | 94 | ||
101 | static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed) | 95 | static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed) |
@@ -109,13 +103,14 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
109 | * We wrap the DMA activate to set the vdma flag. This is needed | 103 | * We wrap the DMA activate to set the vdma flag. This is needed |
110 | * so that the IDE DMA layer issues PIO not DMA commands over the | 104 | * so that the IDE DMA layer issues PIO not DMA commands over the |
111 | * DMA channel | 105 | * DMA channel |
106 | * | ||
107 | * ATAPI is harder so disable it for now using IDE_HFLAG_NO_ATAPI_DMA | ||
112 | */ | 108 | */ |
113 | 109 | ||
114 | static int cs5520_dma_on(ide_drive_t *drive) | 110 | static void cs5520_dma_host_set(ide_drive_t *drive, int on) |
115 | { | 111 | { |
116 | /* ATAPI is harder so leave it for now */ | 112 | drive->vdma = on; |
117 | drive->vdma = 1; | 113 | ide_dma_host_set(drive, on); |
118 | return 0; | ||
119 | } | 114 | } |
120 | 115 | ||
121 | static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) | 116 | static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) |
@@ -126,7 +121,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) | |||
126 | if (hwif->dma_base == 0) | 121 | if (hwif->dma_base == 0) |
127 | return; | 122 | return; |
128 | 123 | ||
129 | hwif->ide_dma_on = &cs5520_dma_on; | 124 | hwif->dma_host_set = &cs5520_dma_host_set; |
130 | } | 125 | } |
131 | 126 | ||
132 | #define DECLARE_CS_DEV(name_str) \ | 127 | #define DECLARE_CS_DEV(name_str) \ |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 1cd4e9cb0521..3ec4c659a37d 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cy82c693.c Version 0.42 Oct 23, 2007 | 2 | * linux/drivers/ide/pci/cy82c693.c Version 0.44 Nov 8, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer | 4 | * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer |
5 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator | 5 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator |
@@ -176,17 +176,12 @@ static void compute_clocks (u8 pio, pio_clocks_t *p_pclk) | |||
176 | * set DMA mode a specific channel for CY82C693 | 176 | * set DMA mode a specific channel for CY82C693 |
177 | */ | 177 | */ |
178 | 178 | ||
179 | static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single) | 179 | static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) |
180 | { | 180 | { |
181 | u8 index = 0, data = 0; | 181 | ide_hwif_t *hwif = drive->hwif; |
182 | u8 single = (mode & 0x10) >> 4, index = 0, data = 0; | ||
182 | 183 | ||
183 | if (mode>2) /* make sure we set a valid mode */ | 184 | index = hwif->channel ? CY82_INDEX_CHANNEL1 : CY82_INDEX_CHANNEL0; |
184 | mode = 2; | ||
185 | |||
186 | if (mode > drive->id->tDMA) /* to be absolutly sure we have a valid mode */ | ||
187 | mode = drive->id->tDMA; | ||
188 | |||
189 | index = (HWIF(drive)->channel==0) ? CY82_INDEX_CHANNEL0 : CY82_INDEX_CHANNEL1; | ||
190 | 185 | ||
191 | #if CY82C693_DEBUG_LOGS | 186 | #if CY82C693_DEBUG_LOGS |
192 | /* for debug let's show the previous values */ | 187 | /* for debug let's show the previous values */ |
@@ -199,7 +194,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single) | |||
199 | (data&0x3), ((data>>2)&1)); | 194 | (data&0x3), ((data>>2)&1)); |
200 | #endif /* CY82C693_DEBUG_LOGS */ | 195 | #endif /* CY82C693_DEBUG_LOGS */ |
201 | 196 | ||
202 | data = (u8)mode|(u8)(single<<2); | 197 | data = (mode & 3) | (single << 2); |
203 | 198 | ||
204 | outb(index, CY82_INDEX_PORT); | 199 | outb(index, CY82_INDEX_PORT); |
205 | outb(data, CY82_DATA_PORT); | 200 | outb(data, CY82_DATA_PORT); |
@@ -207,7 +202,7 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single) | |||
207 | #if CY82C693_DEBUG_INFO | 202 | #if CY82C693_DEBUG_INFO |
208 | printk(KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n", | 203 | printk(KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n", |
209 | drive->name, HWIF(drive)->channel, drive->select.b.unit, | 204 | drive->name, HWIF(drive)->channel, drive->select.b.unit, |
210 | mode, single); | 205 | mode & 3, single); |
211 | #endif /* CY82C693_DEBUG_INFO */ | 206 | #endif /* CY82C693_DEBUG_INFO */ |
212 | 207 | ||
213 | /* | 208 | /* |
@@ -230,39 +225,6 @@ static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single) | |||
230 | #endif /* CY82C693_DEBUG_INFO */ | 225 | #endif /* CY82C693_DEBUG_INFO */ |
231 | } | 226 | } |
232 | 227 | ||
233 | /* | ||
234 | * used to set DMA mode for CY82C693 (single and multi modes) | ||
235 | */ | ||
236 | static int cy82c693_ide_dma_on (ide_drive_t *drive) | ||
237 | { | ||
238 | struct hd_driveid *id = drive->id; | ||
239 | |||
240 | #if CY82C693_DEBUG_INFO | ||
241 | printk (KERN_INFO "dma_on: %s\n", drive->name); | ||
242 | #endif /* CY82C693_DEBUG_INFO */ | ||
243 | |||
244 | if (id != NULL) { | ||
245 | /* Enable DMA on any drive that has DMA | ||
246 | * (multi or single) enabled | ||
247 | */ | ||
248 | if (id->field_valid & 2) { /* regular DMA */ | ||
249 | int mmode, smode; | ||
250 | |||
251 | mmode = id->dma_mword & (id->dma_mword >> 8); | ||
252 | smode = id->dma_1word & (id->dma_1word >> 8); | ||
253 | |||
254 | if (mmode != 0) { | ||
255 | /* enable multi */ | ||
256 | cy82c693_dma_enable(drive, (mmode >> 1), 0); | ||
257 | } else if (smode != 0) { | ||
258 | /* enable single */ | ||
259 | cy82c693_dma_enable(drive, (smode >> 1), 1); | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | return __ide_dma_on(drive); | ||
264 | } | ||
265 | |||
266 | static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) | 228 | static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) |
267 | { | 229 | { |
268 | ide_hwif_t *hwif = HWIF(drive); | 230 | ide_hwif_t *hwif = HWIF(drive); |
@@ -429,11 +391,7 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c | |||
429 | static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) | 391 | static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) |
430 | { | 392 | { |
431 | hwif->set_pio_mode = &cy82c693_set_pio_mode; | 393 | hwif->set_pio_mode = &cy82c693_set_pio_mode; |
432 | 394 | hwif->set_dma_mode = &cy82c693_set_dma_mode; | |
433 | if (hwif->dma_base == 0) | ||
434 | return; | ||
435 | |||
436 | hwif->ide_dma_on = &cy82c693_ide_dma_on; | ||
437 | } | 395 | } |
438 | 396 | ||
439 | static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) | 397 | static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) |
@@ -454,11 +412,11 @@ static const struct ide_port_info cy82c693_chipset __devinitdata = { | |||
454 | .init_iops = init_iops_cy82c693, | 412 | .init_iops = init_iops_cy82c693, |
455 | .init_hwif = init_hwif_cy82c693, | 413 | .init_hwif = init_hwif_cy82c693, |
456 | .chipset = ide_cy82c693, | 414 | .chipset = ide_cy82c693, |
457 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA | | 415 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_CY82C693 | |
458 | IDE_HFLAG_BOOTABLE, | 416 | IDE_HFLAG_BOOTABLE, |
459 | .pio_mask = ATA_PIO4, | 417 | .pio_mask = ATA_PIO4, |
460 | .swdma_mask = ATA_SWDMA2_ONLY, | 418 | .swdma_mask = ATA_SWDMA2, |
461 | .mwdma_mask = ATA_MWDMA2_ONLY, | 419 | .mwdma_mask = ATA_MWDMA2, |
462 | }; | 420 | }; |
463 | 421 | ||
464 | static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 422 | static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 83829081640a..26aa492071bb 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
@@ -80,7 +80,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
80 | hw.irq = dev->irq; | 80 | hw.irq = dev->irq; |
81 | hw.chipset = ide_pci; /* this enables IRQ sharing */ | 81 | hw.chipset = ide_pci; /* this enables IRQ sharing */ |
82 | 82 | ||
83 | rc = ide_register_hw(&hw, &ide_undecoded_slave, 0, &hwif); | 83 | rc = ide_register_hw(&hw, &ide_undecoded_slave, &hwif); |
84 | if (rc < 0) { | 84 | if (rc < 0) { |
85 | printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); | 85 | printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); |
86 | pci_disable_device(dev); | 86 | pci_disable_device(dev); |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 3777fb8c8043..12685939a813 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -725,15 +725,18 @@ static void hpt3xx_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
725 | hpt3xx_set_mode(drive, XFER_PIO_0 + pio); | 725 | hpt3xx_set_mode(drive, XFER_PIO_0 + pio); |
726 | } | 726 | } |
727 | 727 | ||
728 | static int hpt3xx_quirkproc(ide_drive_t *drive) | 728 | static void hpt3xx_quirkproc(ide_drive_t *drive) |
729 | { | 729 | { |
730 | struct hd_driveid *id = drive->id; | 730 | struct hd_driveid *id = drive->id; |
731 | const char **list = quirk_drives; | 731 | const char **list = quirk_drives; |
732 | 732 | ||
733 | while (*list) | 733 | while (*list) |
734 | if (strstr(id->model, *list++)) | 734 | if (strstr(id->model, *list++)) { |
735 | return 1; | 735 | drive->quirk_list = 1; |
736 | return 0; | 736 | return; |
737 | } | ||
738 | |||
739 | drive->quirk_list = 0; | ||
737 | } | 740 | } |
738 | 741 | ||
739 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | 742 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 99b7d763b6c7..e610a5340fdc 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -431,33 +431,29 @@ static u8 __devinit ata66_it821x(ide_hwif_t *hwif) | |||
431 | } | 431 | } |
432 | 432 | ||
433 | /** | 433 | /** |
434 | * it821x_fixup - post init callback | 434 | * it821x_quirkproc - post init callback |
435 | * @hwif: interface | 435 | * @drive: drive |
436 | * | 436 | * |
437 | * This callback is run after the drives have been probed but | 437 | * This callback is run after the drive has been probed but |
438 | * before anything gets attached. It allows drivers to do any | 438 | * before anything gets attached. It allows drivers to do any |
439 | * final tuning that is needed, or fixups to work around bugs. | 439 | * final tuning that is needed, or fixups to work around bugs. |
440 | */ | 440 | */ |
441 | 441 | ||
442 | static void __devinit it821x_fixups(ide_hwif_t *hwif) | 442 | static void __devinit it821x_quirkproc(ide_drive_t *drive) |
443 | { | 443 | { |
444 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 444 | struct it821x_dev *itdev = ide_get_hwifdata(drive->hwif); |
445 | int i; | 445 | struct hd_driveid *id = drive->id; |
446 | u16 *idbits = (u16 *)drive->id; | ||
446 | 447 | ||
447 | if(!itdev->smart) { | 448 | if (!itdev->smart) { |
448 | /* | 449 | /* |
449 | * If we are in pass through mode then not much | 450 | * If we are in pass through mode then not much |
450 | * needs to be done, but we do bother to clear the | 451 | * needs to be done, but we do bother to clear the |
451 | * IRQ mask as we may well be in PIO (eg rev 0x10) | 452 | * IRQ mask as we may well be in PIO (eg rev 0x10) |
452 | * for now and we know unmasking is safe on this chipset. | 453 | * for now and we know unmasking is safe on this chipset. |
453 | */ | 454 | */ |
454 | for (i = 0; i < 2; i++) { | 455 | drive->unmask = 1; |
455 | ide_drive_t *drive = &hwif->drives[i]; | 456 | } else { |
456 | if(drive->present) | ||
457 | drive->unmask = 1; | ||
458 | } | ||
459 | return; | ||
460 | } | ||
461 | /* | 457 | /* |
462 | * Perform fixups on smart mode. We need to "lose" some | 458 | * Perform fixups on smart mode. We need to "lose" some |
463 | * capabilities the firmware lacks but does not filter, and | 459 | * capabilities the firmware lacks but does not filter, and |
@@ -465,16 +461,6 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif) | |||
465 | * in RAID mode. | 461 | * in RAID mode. |
466 | */ | 462 | */ |
467 | 463 | ||
468 | for(i = 0; i < 2; i++) { | ||
469 | ide_drive_t *drive = &hwif->drives[i]; | ||
470 | struct hd_driveid *id; | ||
471 | u16 *idbits; | ||
472 | |||
473 | if(!drive->present) | ||
474 | continue; | ||
475 | id = drive->id; | ||
476 | idbits = (u16 *)drive->id; | ||
477 | |||
478 | /* Check for RAID v native */ | 464 | /* Check for RAID v native */ |
479 | if(strstr(id->model, "Integrated Technology Express")) { | 465 | if(strstr(id->model, "Integrated Technology Express")) { |
480 | /* In raid mode the ident block is slightly buggy | 466 | /* In raid mode the ident block is slightly buggy |
@@ -537,6 +523,8 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
537 | struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL); | 523 | struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL); |
538 | u8 conf; | 524 | u8 conf; |
539 | 525 | ||
526 | hwif->quirkproc = &it821x_quirkproc; | ||
527 | |||
540 | if (idev == NULL) { | 528 | if (idev == NULL) { |
541 | printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n"); | 529 | printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n"); |
542 | return; | 530 | return; |
@@ -633,7 +621,6 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha | |||
633 | .name = name_str, \ | 621 | .name = name_str, \ |
634 | .init_chipset = init_chipset_it821x, \ | 622 | .init_chipset = init_chipset_it821x, \ |
635 | .init_hwif = init_hwif_it821x, \ | 623 | .init_hwif = init_hwif_it821x, \ |
636 | .fixup = it821x_fixups, \ | ||
637 | .host_flags = IDE_HFLAG_BOOTABLE, \ | 624 | .host_flags = IDE_HFLAG_BOOTABLE, \ |
638 | .pio_mask = ATA_PIO4, \ | 625 | .pio_mask = ATA_PIO4, \ |
639 | } | 626 | } |
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index ef4a99b99d1f..89d2363a1ebd 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -203,14 +203,17 @@ static u8 pdcnew_cable_detect(ide_hwif_t *hwif) | |||
203 | return ATA_CBL_PATA80; | 203 | return ATA_CBL_PATA80; |
204 | } | 204 | } |
205 | 205 | ||
206 | static int pdcnew_quirkproc(ide_drive_t *drive) | 206 | static void pdcnew_quirkproc(ide_drive_t *drive) |
207 | { | 207 | { |
208 | const char **list, *model = drive->id->model; | 208 | const char **list, *model = drive->id->model; |
209 | 209 | ||
210 | for (list = pdc_quirk_drives; *list != NULL; list++) | 210 | for (list = pdc_quirk_drives; *list != NULL; list++) |
211 | if (strstr(model, *list) != NULL) | 211 | if (strstr(model, *list) != NULL) { |
212 | return 2; | 212 | drive->quirk_list = 2; |
213 | return 0; | 213 | return; |
214 | } | ||
215 | |||
216 | drive->quirk_list = 0; | ||
214 | } | 217 | } |
215 | 218 | ||
216 | static void pdcnew_reset(ide_drive_t *drive) | 219 | static void pdcnew_reset(ide_drive_t *drive) |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 67b2781e2213..3a1e081fe390 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -176,14 +176,17 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif) | |||
176 | outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); | 176 | outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); |
177 | } | 177 | } |
178 | 178 | ||
179 | static int pdc202xx_quirkproc (ide_drive_t *drive) | 179 | static void pdc202xx_quirkproc(ide_drive_t *drive) |
180 | { | 180 | { |
181 | const char **list, *model = drive->id->model; | 181 | const char **list, *model = drive->id->model; |
182 | 182 | ||
183 | for (list = pdc_quirk_drives; *list != NULL; list++) | 183 | for (list = pdc_quirk_drives; *list != NULL; list++) |
184 | if (strstr(model, *list) != NULL) | 184 | if (strstr(model, *list) != NULL) { |
185 | return 2; | 185 | drive->quirk_list = 2; |
186 | return 0; | 186 | return; |
187 | } | ||
188 | |||
189 | drive->quirk_list = 0; | ||
187 | } | 190 | } |
188 | 191 | ||
189 | static void pdc202xx_old_ide_dma_start(ide_drive_t *drive) | 192 | static void pdc202xx_old_ide_dma_start(ide_drive_t *drive) |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index fef20bd4aa78..32fdf53379f5 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -220,9 +220,9 @@ static void sc1200_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
220 | } | 220 | } |
221 | if (mode != -1) { | 221 | if (mode != -1) { |
222 | printk("SC1200: %s: changing (U)DMA mode\n", drive->name); | 222 | printk("SC1200: %s: changing (U)DMA mode\n", drive->name); |
223 | hwif->dma_off_quietly(drive); | 223 | ide_dma_off_quietly(drive); |
224 | if (ide_set_dma_mode(drive, mode) == 0) | 224 | if (ide_set_dma_mode(drive, mode) == 0 && drive->using_dma) |
225 | hwif->dma_host_on(drive); | 225 | hwif->dma_host_set(drive, 1); |
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index e9bd269547bb..877c09bf4829 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -164,25 +164,12 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
164 | ultra_timing &= ~(0x0F << (4*unit)); | 164 | ultra_timing &= ~(0x0F << (4*unit)); |
165 | ultra_enable &= ~(0x01 << drive->dn); | 165 | ultra_enable &= ~(0x01 << drive->dn); |
166 | 166 | ||
167 | switch(speed) { | 167 | if (speed >= XFER_UDMA_0) { |
168 | case XFER_MW_DMA_2: | 168 | dma_timing |= dma_modes[2]; |
169 | case XFER_MW_DMA_1: | 169 | ultra_timing |= (udma_modes[speed - XFER_UDMA_0] << (4 * unit)); |
170 | case XFER_MW_DMA_0: | 170 | ultra_enable |= (0x01 << drive->dn); |
171 | dma_timing |= dma_modes[speed - XFER_MW_DMA_0]; | 171 | } else if (speed >= XFER_MW_DMA_0) |
172 | break; | 172 | dma_timing |= dma_modes[speed - XFER_MW_DMA_0]; |
173 | |||
174 | case XFER_UDMA_5: | ||
175 | case XFER_UDMA_4: | ||
176 | case XFER_UDMA_3: | ||
177 | case XFER_UDMA_2: | ||
178 | case XFER_UDMA_1: | ||
179 | case XFER_UDMA_0: | ||
180 | dma_timing |= dma_modes[2]; | ||
181 | ultra_timing |= ((udma_modes[speed - XFER_UDMA_0]) << (4*unit)); | ||
182 | ultra_enable |= (0x01 << drive->dn); | ||
183 | default: | ||
184 | break; | ||
185 | } | ||
186 | 173 | ||
187 | pci_write_config_byte(dev, drive_pci2[drive->dn], dma_timing); | 174 | pci_write_config_byte(dev, drive_pci2[drive->dn], dma_timing); |
188 | pci_write_config_byte(dev, (0x56|hwif->channel), ultra_timing); | 175 | pci_write_config_byte(dev, (0x56|hwif->channel), ultra_timing); |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 7e9dade5648d..9e0be7d54980 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -277,21 +277,6 @@ sgiioc4_ide_dma_end(ide_drive_t * drive) | |||
277 | return dma_stat; | 277 | return dma_stat; |
278 | } | 278 | } |
279 | 279 | ||
280 | static int | ||
281 | sgiioc4_ide_dma_on(ide_drive_t * drive) | ||
282 | { | ||
283 | drive->using_dma = 1; | ||
284 | |||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | static void sgiioc4_dma_off_quietly(ide_drive_t *drive) | ||
289 | { | ||
290 | drive->using_dma = 0; | ||
291 | |||
292 | drive->hwif->dma_host_off(drive); | ||
293 | } | ||
294 | |||
295 | static void sgiioc4_set_dma_mode(ide_drive_t *drive, const u8 speed) | 280 | static void sgiioc4_set_dma_mode(ide_drive_t *drive, const u8 speed) |
296 | { | 281 | { |
297 | } | 282 | } |
@@ -303,13 +288,10 @@ sgiioc4_ide_dma_test_irq(ide_drive_t * drive) | |||
303 | return sgiioc4_checkirq(HWIF(drive)); | 288 | return sgiioc4_checkirq(HWIF(drive)); |
304 | } | 289 | } |
305 | 290 | ||
306 | static void sgiioc4_dma_host_on(ide_drive_t * drive) | 291 | static void sgiioc4_dma_host_set(ide_drive_t *drive, int on) |
307 | { | ||
308 | } | ||
309 | |||
310 | static void sgiioc4_dma_host_off(ide_drive_t * drive) | ||
311 | { | 292 | { |
312 | sgiioc4_clearirq(drive); | 293 | if (!on) |
294 | sgiioc4_clearirq(drive); | ||
313 | } | 295 | } |
314 | 296 | ||
315 | static void | 297 | static void |
@@ -593,14 +575,11 @@ ide_init_sgiioc4(ide_hwif_t * hwif) | |||
593 | 575 | ||
594 | hwif->mwdma_mask = ATA_MWDMA2_ONLY; | 576 | hwif->mwdma_mask = ATA_MWDMA2_ONLY; |
595 | 577 | ||
578 | hwif->dma_host_set = &sgiioc4_dma_host_set; | ||
596 | hwif->dma_setup = &sgiioc4_ide_dma_setup; | 579 | hwif->dma_setup = &sgiioc4_ide_dma_setup; |
597 | hwif->dma_start = &sgiioc4_ide_dma_start; | 580 | hwif->dma_start = &sgiioc4_ide_dma_start; |
598 | hwif->ide_dma_end = &sgiioc4_ide_dma_end; | 581 | hwif->ide_dma_end = &sgiioc4_ide_dma_end; |
599 | hwif->ide_dma_on = &sgiioc4_ide_dma_on; | ||
600 | hwif->dma_off_quietly = &sgiioc4_dma_off_quietly; | ||
601 | hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq; | 582 | hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq; |
602 | hwif->dma_host_on = &sgiioc4_dma_host_on; | ||
603 | hwif->dma_host_off = &sgiioc4_dma_host_off; | ||
604 | hwif->dma_lost_irq = &sgiioc4_dma_lost_irq; | 583 | hwif->dma_lost_irq = &sgiioc4_dma_lost_irq; |
605 | hwif->dma_timeout = &ide_dma_timeout; | 584 | hwif->dma_timeout = &ide_dma_timeout; |
606 | } | 585 | } |
@@ -614,6 +593,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
614 | ide_hwif_t *hwif; | 593 | ide_hwif_t *hwif; |
615 | int h; | 594 | int h; |
616 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 595 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
596 | hw_regs_t hw; | ||
617 | 597 | ||
618 | /* | 598 | /* |
619 | * Find an empty HWIF; if none available, return -ENOMEM. | 599 | * Find an empty HWIF; if none available, return -ENOMEM. |
@@ -653,21 +633,16 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
653 | return -ENOMEM; | 633 | return -ENOMEM; |
654 | } | 634 | } |
655 | 635 | ||
656 | if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) { | 636 | /* Initialize the IO registers */ |
657 | hw_regs_t hw; | 637 | memset(&hw, 0, sizeof(hw)); |
658 | 638 | sgiioc4_init_hwif_ports(&hw, cmd_base, ctl, irqport); | |
659 | /* Initialize the IO registers */ | 639 | hw.irq = dev->irq; |
660 | memset(&hw, 0, sizeof(hw)); | 640 | hw.chipset = ide_pci; |
661 | sgiioc4_init_hwif_ports(&hw, cmd_base, ctl, irqport); | 641 | hw.dev = &dev->dev; |
662 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); | 642 | ide_init_port_hw(hwif, &hw); |
663 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; | ||
664 | } | ||
665 | 643 | ||
666 | hwif->irq = dev->irq; | ||
667 | hwif->chipset = ide_pci; | ||
668 | hwif->pci_dev = dev; | 644 | hwif->pci_dev = dev; |
669 | hwif->channel = 0; /* Single Channel chip */ | 645 | hwif->channel = 0; /* Single Channel chip */ |
670 | hwif->gendev.parent = &dev->dev;/* setup proper ancestral information */ | ||
671 | 646 | ||
672 | /* The IOC4 uses MMIO rather than Port IO. */ | 647 | /* The IOC4 uses MMIO rather than Port IO. */ |
673 | default_hwif_mmiops(hwif); | 648 | default_hwif_mmiops(hwif); |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 7b45eaf5afd9..908f37b4e0ee 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -713,9 +713,6 @@ static int is_dev_seagate_sata(ide_drive_t *drive) | |||
713 | const char *s = &drive->id->model[0]; | 713 | const char *s = &drive->id->model[0]; |
714 | unsigned len; | 714 | unsigned len; |
715 | 715 | ||
716 | if (!drive->present) | ||
717 | return 0; | ||
718 | |||
719 | len = strnlen(s, sizeof(drive->id->model)); | 716 | len = strnlen(s, sizeof(drive->id->model)); |
720 | 717 | ||
721 | if ((len > 4) && (!memcmp(s, "ST", 2))) { | 718 | if ((len > 4) && (!memcmp(s, "ST", 2))) { |
@@ -730,18 +727,20 @@ static int is_dev_seagate_sata(ide_drive_t *drive) | |||
730 | } | 727 | } |
731 | 728 | ||
732 | /** | 729 | /** |
733 | * siimage_fixup - post probe fixups | 730 | * sil_quirkproc - post probe fixups |
734 | * @hwif: interface to fix up | 731 | * @drive: drive |
735 | * | 732 | * |
736 | * Called after drive probe we use this to decide whether the | 733 | * Called after drive probe we use this to decide whether the |
737 | * Seagate fixup must be applied. This used to be in init_iops but | 734 | * Seagate fixup must be applied. This used to be in init_iops but |
738 | * that can occur before we know what drives are present. | 735 | * that can occur before we know what drives are present. |
739 | */ | 736 | */ |
740 | 737 | ||
741 | static void __devinit siimage_fixup(ide_hwif_t *hwif) | 738 | static void __devinit sil_quirkproc(ide_drive_t *drive) |
742 | { | 739 | { |
740 | ide_hwif_t *hwif = drive->hwif; | ||
741 | |||
743 | /* Try and raise the rqsize */ | 742 | /* Try and raise the rqsize */ |
744 | if (!is_sata(hwif) || !is_dev_seagate_sata(&hwif->drives[0])) | 743 | if (!is_sata(hwif) || !is_dev_seagate_sata(drive)) |
745 | hwif->rqsize = 128; | 744 | hwif->rqsize = 128; |
746 | } | 745 | } |
747 | 746 | ||
@@ -804,6 +803,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
804 | 803 | ||
805 | hwif->set_pio_mode = &sil_set_pio_mode; | 804 | hwif->set_pio_mode = &sil_set_pio_mode; |
806 | hwif->set_dma_mode = &sil_set_dma_mode; | 805 | hwif->set_dma_mode = &sil_set_dma_mode; |
806 | hwif->quirkproc = &sil_quirkproc; | ||
807 | 807 | ||
808 | if (sata) { | 808 | if (sata) { |
809 | static int first = 1; | 809 | static int first = 1; |
@@ -842,7 +842,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
842 | .init_chipset = init_chipset_siimage, \ | 842 | .init_chipset = init_chipset_siimage, \ |
843 | .init_iops = init_iops_siimage, \ | 843 | .init_iops = init_iops_siimage, \ |
844 | .init_hwif = init_hwif_siimage, \ | 844 | .init_hwif = init_hwif_siimage, \ |
845 | .fixup = siimage_fixup, \ | ||
846 | .host_flags = IDE_HFLAG_BOOTABLE, \ | 845 | .host_flags = IDE_HFLAG_BOOTABLE, \ |
847 | .pio_mask = ATA_PIO4, \ | 846 | .pio_mask = ATA_PIO4, \ |
848 | .mwdma_mask = ATA_MWDMA2, \ | 847 | .mwdma_mask = ATA_MWDMA2, \ |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 069f104fdcea..c7a125b66c29 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * -- Benjamin Herrenschmidt (01/11/03) benh@kernel.crashing.org | 13 | * -- Benjamin Herrenschmidt (01/11/03) benh@kernel.crashing.org |
14 | * | 14 | * |
15 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> | 15 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> |
16 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | ||
16 | */ | 17 | */ |
17 | 18 | ||
18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
@@ -90,14 +91,8 @@ static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
90 | drive->drive_data &= 0xffff0000; | 91 | drive->drive_data &= 0xffff0000; |
91 | drive->drive_data |= drv_ctrl; | 92 | drive->drive_data |= drv_ctrl; |
92 | 93 | ||
93 | if (!drive->using_dma) { | 94 | pci_write_config_word(dev, reg, drv_ctrl); |
94 | /* | 95 | pci_read_config_word (dev, reg, &drv_ctrl); |
95 | * If we are actually using MW DMA, then we can not | ||
96 | * reprogram the interface drive control register. | ||
97 | */ | ||
98 | pci_write_config_word(dev, reg, drv_ctrl); | ||
99 | pci_read_config_word (dev, reg, &drv_ctrl); | ||
100 | } | ||
101 | 96 | ||
102 | printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, | 97 | printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, |
103 | ide_xfer_verbose(pio + XFER_PIO_0), | 98 | ide_xfer_verbose(pio + XFER_PIO_0), |
@@ -123,17 +118,6 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
123 | */ | 118 | */ |
124 | drive->drive_data &= 0x0000ffff; | 119 | drive->drive_data &= 0x0000ffff; |
125 | drive->drive_data |= (unsigned long)drv_ctrl << 16; | 120 | drive->drive_data |= (unsigned long)drv_ctrl << 16; |
126 | |||
127 | /* | ||
128 | * If we are already using DMA, we just reprogram | ||
129 | * the drive control register. | ||
130 | */ | ||
131 | if (drive->using_dma) { | ||
132 | struct pci_dev *dev = HWIF(drive)->pci_dev; | ||
133 | int reg = 0x44 + drive->dn * 4; | ||
134 | |||
135 | pci_write_config_word(dev, reg, drv_ctrl); | ||
136 | } | ||
137 | } | 121 | } |
138 | 122 | ||
139 | /* | 123 | /* |
@@ -201,6 +185,11 @@ static void sl82c105_dma_start(ide_drive_t *drive) | |||
201 | { | 185 | { |
202 | ide_hwif_t *hwif = HWIF(drive); | 186 | ide_hwif_t *hwif = HWIF(drive); |
203 | struct pci_dev *dev = hwif->pci_dev; | 187 | struct pci_dev *dev = hwif->pci_dev; |
188 | int reg = 0x44 + drive->dn * 4; | ||
189 | |||
190 | DBG(("%s(drive:%s)\n", __FUNCTION__, drive->name)); | ||
191 | |||
192 | pci_write_config_word(dev, reg, drive->drive_data >> 16); | ||
204 | 193 | ||
205 | sl82c105_reset_host(dev); | 194 | sl82c105_reset_host(dev); |
206 | ide_dma_start(drive); | 195 | ide_dma_start(drive); |
@@ -214,64 +203,24 @@ static void sl82c105_dma_timeout(ide_drive_t *drive) | |||
214 | ide_dma_timeout(drive); | 203 | ide_dma_timeout(drive); |
215 | } | 204 | } |
216 | 205 | ||
217 | static int sl82c105_ide_dma_on(ide_drive_t *drive) | 206 | static int sl82c105_dma_end(ide_drive_t *drive) |
218 | { | ||
219 | struct pci_dev *dev = HWIF(drive)->pci_dev; | ||
220 | int rc, reg = 0x44 + drive->dn * 4; | ||
221 | |||
222 | DBG(("sl82c105_ide_dma_on(drive:%s)\n", drive->name)); | ||
223 | |||
224 | rc = __ide_dma_on(drive); | ||
225 | if (rc == 0) { | ||
226 | pci_write_config_word(dev, reg, drive->drive_data >> 16); | ||
227 | |||
228 | printk(KERN_INFO "%s: DMA enabled\n", drive->name); | ||
229 | } | ||
230 | return rc; | ||
231 | } | ||
232 | |||
233 | static void sl82c105_dma_off_quietly(ide_drive_t *drive) | ||
234 | { | 207 | { |
235 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 208 | struct pci_dev *dev = HWIF(drive)->pci_dev; |
236 | int reg = 0x44 + drive->dn * 4; | 209 | int reg = 0x44 + drive->dn * 4; |
210 | int ret; | ||
237 | 211 | ||
238 | DBG(("sl82c105_dma_off_quietly(drive:%s)\n", drive->name)); | 212 | DBG(("%s(drive:%s)\n", __FUNCTION__, drive->name)); |
239 | 213 | ||
240 | pci_write_config_word(dev, reg, drive->drive_data); | 214 | ret = __ide_dma_end(drive); |
241 | 215 | ||
242 | ide_dma_off_quietly(drive); | 216 | pci_write_config_word(dev, reg, drive->drive_data); |
243 | } | ||
244 | 217 | ||
245 | /* | 218 | return ret; |
246 | * Ok, that is nasty, but we must make sure the DMA timings | ||
247 | * won't be used for a PIO access. The solution here is | ||
248 | * to make sure the 16 bits mode is diabled on the channel | ||
249 | * when DMA is enabled, thus causing the chip to use PIO0 | ||
250 | * timings for those operations. | ||
251 | */ | ||
252 | static void sl82c105_selectproc(ide_drive_t *drive) | ||
253 | { | ||
254 | ide_hwif_t *hwif = HWIF(drive); | ||
255 | struct pci_dev *dev = hwif->pci_dev; | ||
256 | u32 val, old, mask; | ||
257 | |||
258 | //DBG(("sl82c105_selectproc(drive:%s)\n", drive->name)); | ||
259 | |||
260 | mask = hwif->channel ? CTRL_P1F16 : CTRL_P0F16; | ||
261 | old = val = (u32)pci_get_drvdata(dev); | ||
262 | if (drive->using_dma) | ||
263 | val &= ~mask; | ||
264 | else | ||
265 | val |= mask; | ||
266 | if (old != val) { | ||
267 | pci_write_config_dword(dev, 0x40, val); | ||
268 | pci_set_drvdata(dev, (void *)val); | ||
269 | } | ||
270 | } | 219 | } |
271 | 220 | ||
272 | /* | 221 | /* |
273 | * ATA reset will clear the 16 bits mode in the control | 222 | * ATA reset will clear the 16 bits mode in the control |
274 | * register, we need to update our cache | 223 | * register, we need to reprogram it |
275 | */ | 224 | */ |
276 | static void sl82c105_resetproc(ide_drive_t *drive) | 225 | static void sl82c105_resetproc(ide_drive_t *drive) |
277 | { | 226 | { |
@@ -281,7 +230,8 @@ static void sl82c105_resetproc(ide_drive_t *drive) | |||
281 | DBG(("sl82c105_resetproc(drive:%s)\n", drive->name)); | 230 | DBG(("sl82c105_resetproc(drive:%s)\n", drive->name)); |
282 | 231 | ||
283 | pci_read_config_dword(dev, 0x40, &val); | 232 | pci_read_config_dword(dev, 0x40, &val); |
284 | pci_set_drvdata(dev, (void *)val); | 233 | val |= (CTRL_P1F16 | CTRL_P0F16); |
234 | pci_write_config_dword(dev, 0x40, val); | ||
285 | } | 235 | } |
286 | 236 | ||
287 | /* | 237 | /* |
@@ -334,7 +284,6 @@ static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const c | |||
334 | pci_read_config_dword(dev, 0x40, &val); | 284 | pci_read_config_dword(dev, 0x40, &val); |
335 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; | 285 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; |
336 | pci_write_config_dword(dev, 0x40, val); | 286 | pci_write_config_dword(dev, 0x40, val); |
337 | pci_set_drvdata(dev, (void *)val); | ||
338 | 287 | ||
339 | return dev->irq; | 288 | return dev->irq; |
340 | } | 289 | } |
@@ -350,7 +299,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
350 | 299 | ||
351 | hwif->set_pio_mode = &sl82c105_set_pio_mode; | 300 | hwif->set_pio_mode = &sl82c105_set_pio_mode; |
352 | hwif->set_dma_mode = &sl82c105_set_dma_mode; | 301 | hwif->set_dma_mode = &sl82c105_set_dma_mode; |
353 | hwif->selectproc = &sl82c105_selectproc; | ||
354 | hwif->resetproc = &sl82c105_resetproc; | 302 | hwif->resetproc = &sl82c105_resetproc; |
355 | 303 | ||
356 | if (!hwif->dma_base) | 304 | if (!hwif->dma_base) |
@@ -369,10 +317,9 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
369 | 317 | ||
370 | hwif->mwdma_mask = ATA_MWDMA2; | 318 | hwif->mwdma_mask = ATA_MWDMA2; |
371 | 319 | ||
372 | hwif->ide_dma_on = &sl82c105_ide_dma_on; | ||
373 | hwif->dma_off_quietly = &sl82c105_dma_off_quietly; | ||
374 | hwif->dma_lost_irq = &sl82c105_dma_lost_irq; | 320 | hwif->dma_lost_irq = &sl82c105_dma_lost_irq; |
375 | hwif->dma_start = &sl82c105_dma_start; | 321 | hwif->dma_start = &sl82c105_dma_start; |
322 | hwif->ide_dma_end = &sl82c105_dma_end; | ||
376 | hwif->dma_timeout = &sl82c105_dma_timeout; | 323 | hwif->dma_timeout = &sl82c105_dma_timeout; |
377 | 324 | ||
378 | if (hwif->mate) | 325 | if (hwif->mate) |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 0151d7fdfb8a..04cd893e1ab0 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -241,11 +241,7 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive) | |||
241 | return (status == 0x00ff); | 241 | return (status == 0x00ff); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void trm290_dma_host_on(ide_drive_t *drive) | 244 | static void trm290_dma_host_set(ide_drive_t *drive, int on) |
245 | { | ||
246 | } | ||
247 | |||
248 | static void trm290_dma_host_off(ide_drive_t *drive) | ||
249 | { | 245 | { |
250 | } | 246 | } |
251 | 247 | ||
@@ -289,8 +285,7 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | |||
289 | 285 | ||
290 | ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); | 286 | ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); |
291 | 287 | ||
292 | hwif->dma_host_off = &trm290_dma_host_off; | 288 | hwif->dma_host_set = &trm290_dma_host_set; |
293 | hwif->dma_host_on = &trm290_dma_host_on; | ||
294 | hwif->dma_setup = &trm290_dma_setup; | 289 | hwif->dma_setup = &trm290_dma_setup; |
295 | hwif->dma_exec_cmd = &trm290_dma_exec_cmd; | 290 | hwif->dma_exec_cmd = &trm290_dma_exec_cmd; |
296 | hwif->dma_start = &trm290_dma_start; | 291 | hwif->dma_start = &trm290_dma_start; |
diff --git a/drivers/ide/ppc/Makefile b/drivers/ide/ppc/Makefile new file mode 100644 index 000000000000..65af5848b28c --- /dev/null +++ b/drivers/ide/ppc/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | |||
2 | obj-$(CONFIG_BLK_DEV_IDE_PMAC) += pmac.o | ||
3 | obj-$(CONFIG_BLK_DEV_MPC8xx_IDE) += mpc8xx.o | ||
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index 5f0da35ab5ad..3fd5d45b5e0e 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c | |||
@@ -838,3 +838,21 @@ void m8xx_ide_init(void) | |||
838 | ppc_ide_md.default_io_base = m8xx_ide_default_io_base; | 838 | ppc_ide_md.default_io_base = m8xx_ide_default_io_base; |
839 | ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports; | 839 | ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports; |
840 | } | 840 | } |
841 | |||
842 | static int __init mpc8xx_ide_probe(void) | ||
843 | { | ||
844 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
845 | |||
846 | #ifdef IDE0_BASE_OFFSET | ||
847 | idx[0] = 0; | ||
848 | #ifdef IDE1_BASE_OFFSET | ||
849 | idx[1] = 1; | ||
850 | #endif | ||
851 | #endif | ||
852 | |||
853 | ide_device_add(idx); | ||
854 | |||
855 | return 0; | ||
856 | } | ||
857 | |||
858 | module_init(mpc8xx_ide_probe); | ||
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 3dce80092fff..736d12c8e68a 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1012,12 +1012,11 @@ pmac_ide_do_resume(ide_hwif_t *hwif) | |||
1012 | * rare machines unfortunately, but it's better this way. | 1012 | * rare machines unfortunately, but it's better this way. |
1013 | */ | 1013 | */ |
1014 | static int | 1014 | static int |
1015 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | 1015 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) |
1016 | { | 1016 | { |
1017 | struct device_node *np = pmif->node; | 1017 | struct device_node *np = pmif->node; |
1018 | const int *bidp; | 1018 | const int *bidp; |
1019 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 1019 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
1020 | hw_regs_t hw; | ||
1021 | 1020 | ||
1022 | pmif->cable_80 = 0; | 1021 | pmif->cable_80 = 0; |
1023 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 1022 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
@@ -1103,11 +1102,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1103 | /* Tell common code _not_ to mess with resources */ | 1102 | /* Tell common code _not_ to mess with resources */ |
1104 | hwif->mmio = 1; | 1103 | hwif->mmio = 1; |
1105 | hwif->hwif_data = pmif; | 1104 | hwif->hwif_data = pmif; |
1106 | memset(&hw, 0, sizeof(hw)); | 1105 | hw->chipset = ide_pmac; |
1107 | pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, &hwif->irq); | 1106 | ide_init_port_hw(hwif, hw); |
1108 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); | 1107 | hwif->noprobe = pmif->mediabay; |
1109 | hwif->chipset = ide_pmac; | ||
1110 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay; | ||
1111 | hwif->hold = pmif->mediabay; | 1108 | hwif->hold = pmif->mediabay; |
1112 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | 1109 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
1113 | hwif->drives[0].unmask = 1; | 1110 | hwif->drives[0].unmask = 1; |
@@ -1136,8 +1133,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1136 | hwif->noprobe = 0; | 1133 | hwif->noprobe = 0; |
1137 | #endif /* CONFIG_PMAC_MEDIABAY */ | 1134 | #endif /* CONFIG_PMAC_MEDIABAY */ |
1138 | 1135 | ||
1139 | hwif->sg_max_nents = MAX_DCMDS; | ||
1140 | |||
1141 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC | 1136 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC |
1142 | /* has a DBDMA controller channel */ | 1137 | /* has a DBDMA controller channel */ |
1143 | if (pmif->dma_regs) | 1138 | if (pmif->dma_regs) |
@@ -1163,6 +1158,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1163 | ide_hwif_t *hwif; | 1158 | ide_hwif_t *hwif; |
1164 | pmac_ide_hwif_t *pmif; | 1159 | pmac_ide_hwif_t *pmif; |
1165 | int i, rc; | 1160 | int i, rc; |
1161 | hw_regs_t hw; | ||
1166 | 1162 | ||
1167 | i = 0; | 1163 | i = 0; |
1168 | while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0 | 1164 | while (i < MAX_HWIFS && (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0 |
@@ -1205,7 +1201,6 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1205 | regbase = (unsigned long) base; | 1201 | regbase = (unsigned long) base; |
1206 | 1202 | ||
1207 | hwif->pci_dev = mdev->bus->pdev; | 1203 | hwif->pci_dev = mdev->bus->pdev; |
1208 | hwif->gendev.parent = &mdev->ofdev.dev; | ||
1209 | 1204 | ||
1210 | pmif->mdev = mdev; | 1205 | pmif->mdev = mdev; |
1211 | pmif->node = mdev->ofdev.node; | 1206 | pmif->node = mdev->ofdev.node; |
@@ -1223,7 +1218,12 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1223 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 1218 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ |
1224 | dev_set_drvdata(&mdev->ofdev.dev, hwif); | 1219 | dev_set_drvdata(&mdev->ofdev.dev, hwif); |
1225 | 1220 | ||
1226 | rc = pmac_ide_setup_device(pmif, hwif); | 1221 | memset(&hw, 0, sizeof(hw)); |
1222 | pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL); | ||
1223 | hw.irq = irq; | ||
1224 | hw.dev = &mdev->ofdev.dev; | ||
1225 | |||
1226 | rc = pmac_ide_setup_device(pmif, hwif, &hw); | ||
1227 | if (rc != 0) { | 1227 | if (rc != 0) { |
1228 | /* The inteface is released to the common IDE layer */ | 1228 | /* The inteface is released to the common IDE layer */ |
1229 | dev_set_drvdata(&mdev->ofdev.dev, NULL); | 1229 | dev_set_drvdata(&mdev->ofdev.dev, NULL); |
@@ -1282,6 +1282,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1282 | void __iomem *base; | 1282 | void __iomem *base; |
1283 | unsigned long rbase, rlen; | 1283 | unsigned long rbase, rlen; |
1284 | int i, rc; | 1284 | int i, rc; |
1285 | hw_regs_t hw; | ||
1285 | 1286 | ||
1286 | np = pci_device_to_OF_node(pdev); | 1287 | np = pci_device_to_OF_node(pdev); |
1287 | if (np == NULL) { | 1288 | if (np == NULL) { |
@@ -1315,7 +1316,6 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1315 | } | 1316 | } |
1316 | 1317 | ||
1317 | hwif->pci_dev = pdev; | 1318 | hwif->pci_dev = pdev; |
1318 | hwif->gendev.parent = &pdev->dev; | ||
1319 | pmif->mdev = NULL; | 1319 | pmif->mdev = NULL; |
1320 | pmif->node = np; | 1320 | pmif->node = np; |
1321 | 1321 | ||
@@ -1332,7 +1332,12 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1332 | 1332 | ||
1333 | pci_set_drvdata(pdev, hwif); | 1333 | pci_set_drvdata(pdev, hwif); |
1334 | 1334 | ||
1335 | rc = pmac_ide_setup_device(pmif, hwif); | 1335 | memset(&hw, 0, sizeof(hw)); |
1336 | pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL); | ||
1337 | hw.irq = pdev->irq; | ||
1338 | hw.dev = &pdev->dev; | ||
1339 | |||
1340 | rc = pmac_ide_setup_device(pmif, hwif, &hw); | ||
1336 | if (rc != 0) { | 1341 | if (rc != 0) { |
1337 | /* The inteface is released to the common IDE layer */ | 1342 | /* The inteface is released to the common IDE layer */ |
1338 | pci_set_drvdata(pdev, NULL); | 1343 | pci_set_drvdata(pdev, NULL); |
@@ -1698,11 +1703,7 @@ pmac_ide_dma_test_irq (ide_drive_t *drive) | |||
1698 | return 1; | 1703 | return 1; |
1699 | } | 1704 | } |
1700 | 1705 | ||
1701 | static void pmac_ide_dma_host_off(ide_drive_t *drive) | 1706 | static void pmac_ide_dma_host_set(ide_drive_t *drive, int on) |
1702 | { | ||
1703 | } | ||
1704 | |||
1705 | static void pmac_ide_dma_host_on(ide_drive_t *drive) | ||
1706 | { | 1707 | { |
1707 | } | 1708 | } |
1708 | 1709 | ||
@@ -1748,15 +1749,14 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1748 | return; | 1749 | return; |
1749 | } | 1750 | } |
1750 | 1751 | ||
1751 | hwif->dma_off_quietly = &ide_dma_off_quietly; | 1752 | hwif->sg_max_nents = MAX_DCMDS; |
1752 | hwif->ide_dma_on = &__ide_dma_on; | 1753 | |
1754 | hwif->dma_host_set = &pmac_ide_dma_host_set; | ||
1753 | hwif->dma_setup = &pmac_ide_dma_setup; | 1755 | hwif->dma_setup = &pmac_ide_dma_setup; |
1754 | hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd; | 1756 | hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd; |
1755 | hwif->dma_start = &pmac_ide_dma_start; | 1757 | hwif->dma_start = &pmac_ide_dma_start; |
1756 | hwif->ide_dma_end = &pmac_ide_dma_end; | 1758 | hwif->ide_dma_end = &pmac_ide_dma_end; |
1757 | hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq; | 1759 | hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq; |
1758 | hwif->dma_host_off = &pmac_ide_dma_host_off; | ||
1759 | hwif->dma_host_on = &pmac_ide_dma_host_on; | ||
1760 | hwif->dma_timeout = &ide_dma_timeout; | 1760 | hwif->dma_timeout = &ide_dma_timeout; |
1761 | hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; | 1761 | hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; |
1762 | 1762 | ||
@@ -1786,3 +1786,5 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1786 | } | 1786 | } |
1787 | 1787 | ||
1788 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 1788 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ |
1789 | |||
1790 | module_init(pmac_ide_probe); | ||
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index d2cd5a3d38f8..676c66e72881 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -165,13 +165,17 @@ static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_ | |||
165 | 165 | ||
166 | dma_base = pci_resource_start(dev, baridx); | 166 | dma_base = pci_resource_start(dev, baridx); |
167 | 167 | ||
168 | if (dma_base == 0) | 168 | if (dma_base == 0) { |
169 | printk(KERN_ERR "%s: DMA base is invalid\n", d->name); | 169 | printk(KERN_ERR "%s: DMA base is invalid\n", d->name); |
170 | return 0; | ||
171 | } | ||
170 | } | 172 | } |
171 | 173 | ||
172 | if ((d->host_flags & IDE_HFLAG_CS5520) == 0 && dma_base) { | 174 | if (hwif->channel) |
175 | dma_base += 8; | ||
176 | |||
177 | if ((d->host_flags & IDE_HFLAG_CS5520) == 0) { | ||
173 | u8 simplex_stat = 0; | 178 | u8 simplex_stat = 0; |
174 | dma_base += hwif->channel ? 8 : 0; | ||
175 | 179 | ||
176 | switch(dev->device) { | 180 | switch(dev->device) { |
177 | case PCI_DEVICE_ID_AL_M5219: | 181 | case PCI_DEVICE_ID_AL_M5219: |
@@ -359,6 +363,8 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port | |||
359 | unsigned long ctl = 0, base = 0; | 363 | unsigned long ctl = 0, base = 0; |
360 | ide_hwif_t *hwif; | 364 | ide_hwif_t *hwif; |
361 | u8 bootable = (d->host_flags & IDE_HFLAG_BOOTABLE) ? 1 : 0; | 365 | u8 bootable = (d->host_flags & IDE_HFLAG_BOOTABLE) ? 1 : 0; |
366 | u8 oldnoprobe = 0; | ||
367 | struct hw_regs_s hw; | ||
362 | 368 | ||
363 | if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { | 369 | if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { |
364 | /* Possibly we should fail if these checks report true */ | 370 | /* Possibly we should fail if these checks report true */ |
@@ -381,26 +387,25 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port | |||
381 | } | 387 | } |
382 | if ((hwif = ide_match_hwif(base, bootable, d->name)) == NULL) | 388 | if ((hwif = ide_match_hwif(base, bootable, d->name)) == NULL) |
383 | return NULL; /* no room in ide_hwifs[] */ | 389 | return NULL; /* no room in ide_hwifs[] */ |
384 | if (hwif->io_ports[IDE_DATA_OFFSET] != base || | 390 | |
385 | hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { | 391 | memset(&hw, 0, sizeof(hw)); |
386 | hw_regs_t hw; | 392 | hw.irq = hwif->irq ? hwif->irq : irq; |
387 | 393 | hw.dev = &dev->dev; | |
388 | memset(&hw, 0, sizeof(hw)); | 394 | hw.chipset = d->chipset ? d->chipset : ide_pci; |
389 | #ifndef CONFIG_IDE_ARCH_OBSOLETE_INIT | 395 | ide_std_init_ports(&hw, base, ctl | 2); |
390 | ide_std_init_ports(&hw, base, ctl | 2); | 396 | |
391 | #else | 397 | if (hwif->io_ports[IDE_DATA_OFFSET] == base && |
392 | ide_init_hwif_ports(&hw, base, ctl | 2, NULL); | 398 | hwif->io_ports[IDE_CONTROL_OFFSET] == (ctl | 2)) |
393 | #endif | 399 | oldnoprobe = hwif->noprobe; |
394 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); | 400 | |
395 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; | 401 | ide_init_port_hw(hwif, &hw); |
396 | } | 402 | |
397 | hwif->chipset = d->chipset ? d->chipset : ide_pci; | 403 | hwif->noprobe = oldnoprobe; |
404 | |||
398 | hwif->pci_dev = dev; | 405 | hwif->pci_dev = dev; |
399 | hwif->cds = d; | 406 | hwif->cds = d; |
400 | hwif->channel = port; | 407 | hwif->channel = port; |
401 | 408 | ||
402 | if (!hwif->irq) | ||
403 | hwif->irq = irq; | ||
404 | if (mate) { | 409 | if (mate) { |
405 | hwif->mate = mate; | 410 | hwif->mate = mate; |
406 | mate->mate = hwif; | 411 | mate->mate = hwif; |
@@ -535,12 +540,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int | |||
535 | if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) | 540 | if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) |
536 | continue; | 541 | continue; |
537 | 542 | ||
538 | /* setup proper ancestral information */ | ||
539 | hwif->gendev.parent = &dev->dev; | ||
540 | |||
541 | *(idx + port) = hwif->index; | 543 | *(idx + port) = hwif->index; |
542 | 544 | ||
543 | |||
544 | if (d->init_iops) | 545 | if (d->init_iops) |
545 | d->init_iops(hwif); | 546 | d->init_iops(hwif); |
546 | 547 | ||
@@ -551,8 +552,6 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int | |||
551 | (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) | 552 | (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) |
552 | hwif->irq = port ? 15 : 14; | 553 | hwif->irq = port ? 15 : 14; |
553 | 554 | ||
554 | hwif->fixup = d->fixup; | ||
555 | |||
556 | hwif->host_flags = d->host_flags; | 555 | hwif->host_flags = d->host_flags; |
557 | hwif->pio_mask = d->pio_mask; | 556 | hwif->pio_mask = d->pio_mask; |
558 | 557 | ||
@@ -699,105 +698,3 @@ out: | |||
699 | } | 698 | } |
700 | 699 | ||
701 | EXPORT_SYMBOL_GPL(ide_setup_pci_devices); | 700 | EXPORT_SYMBOL_GPL(ide_setup_pci_devices); |
702 | |||
703 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | ||
704 | /* | ||
705 | * Module interfaces | ||
706 | */ | ||
707 | |||
708 | static int pre_init = 1; /* Before first ordered IDE scan */ | ||
709 | static LIST_HEAD(ide_pci_drivers); | ||
710 | |||
711 | /* | ||
712 | * __ide_pci_register_driver - attach IDE driver | ||
713 | * @driver: pci driver | ||
714 | * @module: owner module of the driver | ||
715 | * | ||
716 | * Registers a driver with the IDE layer. The IDE layer arranges that | ||
717 | * boot time setup is done in the expected device order and then | ||
718 | * hands the controllers off to the core PCI code to do the rest of | ||
719 | * the work. | ||
720 | * | ||
721 | * Returns are the same as for pci_register_driver | ||
722 | */ | ||
723 | |||
724 | int __ide_pci_register_driver(struct pci_driver *driver, struct module *module, | ||
725 | const char *mod_name) | ||
726 | { | ||
727 | if (!pre_init) | ||
728 | return __pci_register_driver(driver, module, mod_name); | ||
729 | driver->driver.owner = module; | ||
730 | list_add_tail(&driver->node, &ide_pci_drivers); | ||
731 | return 0; | ||
732 | } | ||
733 | EXPORT_SYMBOL_GPL(__ide_pci_register_driver); | ||
734 | |||
735 | /** | ||
736 | * ide_scan_pcidev - find an IDE driver for a device | ||
737 | * @dev: PCI device to check | ||
738 | * | ||
739 | * Look for an IDE driver to handle the device we are considering. | ||
740 | * This is only used during boot up to get the ordering correct. After | ||
741 | * boot up the pci layer takes over the job. | ||
742 | */ | ||
743 | |||
744 | static int __init ide_scan_pcidev(struct pci_dev *dev) | ||
745 | { | ||
746 | struct list_head *l; | ||
747 | struct pci_driver *d; | ||
748 | |||
749 | list_for_each(l, &ide_pci_drivers) { | ||
750 | d = list_entry(l, struct pci_driver, node); | ||
751 | if (d->id_table) { | ||
752 | const struct pci_device_id *id = | ||
753 | pci_match_id(d->id_table, dev); | ||
754 | |||
755 | if (id != NULL && d->probe(dev, id) >= 0) { | ||
756 | dev->driver = d; | ||
757 | pci_dev_get(dev); | ||
758 | return 1; | ||
759 | } | ||
760 | } | ||
761 | } | ||
762 | return 0; | ||
763 | } | ||
764 | |||
765 | /** | ||
766 | * ide_scan_pcibus - perform the initial IDE driver scan | ||
767 | * @scan_direction: set for reverse order scanning | ||
768 | * | ||
769 | * Perform the initial bus rather than driver ordered scan of the | ||
770 | * PCI drivers. After this all IDE pci handling becomes standard | ||
771 | * module ordering not traditionally ordered. | ||
772 | */ | ||
773 | |||
774 | void __init ide_scan_pcibus (int scan_direction) | ||
775 | { | ||
776 | struct pci_dev *dev = NULL; | ||
777 | struct pci_driver *d; | ||
778 | struct list_head *l, *n; | ||
779 | |||
780 | pre_init = 0; | ||
781 | if (!scan_direction) | ||
782 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev))) | ||
783 | ide_scan_pcidev(dev); | ||
784 | else | ||
785 | while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, | ||
786 | dev))) | ||
787 | ide_scan_pcidev(dev); | ||
788 | |||
789 | /* | ||
790 | * Hand the drivers over to the PCI layer now we | ||
791 | * are post init. | ||
792 | */ | ||
793 | |||
794 | list_for_each_safe(l, n, &ide_pci_drivers) { | ||
795 | list_del(l); | ||
796 | d = list_entry(l, struct pci_driver, node); | ||
797 | if (__pci_register_driver(d, d->driver.owner, | ||
798 | d->driver.mod_name)) | ||
799 | printk(KERN_ERR "%s: failed to register %s driver\n", | ||
800 | __FUNCTION__, d->driver.mod_name); | ||
801 | } | ||
802 | } | ||
803 | #endif | ||
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index 48d647abea46..eaba4a9b231e 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
@@ -563,7 +563,8 @@ static void media_bay_step(int i) | |||
563 | ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); | 563 | ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); |
564 | hw.irq = bay->cd_irq; | 564 | hw.irq = bay->cd_irq; |
565 | hw.chipset = ide_pmac; | 565 | hw.chipset = ide_pmac; |
566 | bay->cd_index = ide_register_hw(&hw, NULL, 0, NULL); | 566 | bay->cd_index = |
567 | ide_register_hw(&hw, NULL, NULL); | ||
567 | pmu_resume(); | 568 | pmu_resume(); |
568 | } | 569 | } |
569 | if (bay->cd_index == -1) { | 570 | if (bay->cd_index == -1) { |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index bd20a4e8663a..49b7a4c31a6d 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -143,7 +143,6 @@ enum rq_cmd_type_bits { | |||
143 | * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver | 143 | * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver |
144 | * private REQ_LB opcodes to differentiate what type of request this is | 144 | * private REQ_LB opcodes to differentiate what type of request this is |
145 | */ | 145 | */ |
146 | REQ_TYPE_ATA_CMD, | ||
147 | REQ_TYPE_ATA_TASKFILE, | 146 | REQ_TYPE_ATA_TASKFILE, |
148 | REQ_TYPE_ATA_PC, | 147 | REQ_TYPE_ATA_PC, |
149 | }; | 148 | }; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 1e4409937ec3..27cb39de2ae2 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -107,7 +107,6 @@ typedef unsigned char byte; /* used everywhere */ | |||
107 | #define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) | 107 | #define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) |
108 | #define BAD_STAT (BAD_R_STAT | DRQ_STAT) | 108 | #define BAD_STAT (BAD_R_STAT | DRQ_STAT) |
109 | #define DRIVE_READY (READY_STAT | SEEK_STAT) | 109 | #define DRIVE_READY (READY_STAT | SEEK_STAT) |
110 | #define DATA_READY (DRQ_STAT) | ||
111 | 110 | ||
112 | #define BAD_CRC (ABRT_ERR | ICRC_ERR) | 111 | #define BAD_CRC (ABRT_ERR | ICRC_ERR) |
113 | 112 | ||
@@ -198,8 +197,11 @@ typedef struct hw_regs_s { | |||
198 | } hw_regs_t; | 197 | } hw_regs_t; |
199 | 198 | ||
200 | struct hwif_s * ide_find_port(unsigned long); | 199 | struct hwif_s * ide_find_port(unsigned long); |
200 | void ide_init_port_data(struct hwif_s *, unsigned int); | ||
201 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); | ||
201 | 202 | ||
202 | int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, | 203 | struct ide_drive_s; |
204 | int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *), | ||
203 | struct hwif_s **); | 205 | struct hwif_s **); |
204 | 206 | ||
205 | void ide_setup_ports( hw_regs_t *hw, | 207 | void ide_setup_ports( hw_regs_t *hw, |
@@ -391,7 +393,6 @@ typedef struct ide_drive_s { | |||
391 | u8 state; /* retry state */ | 393 | u8 state; /* retry state */ |
392 | u8 waiting_for_dma; /* dma currently in progress */ | 394 | u8 waiting_for_dma; /* dma currently in progress */ |
393 | u8 unmask; /* okay to unmask other irqs */ | 395 | u8 unmask; /* okay to unmask other irqs */ |
394 | u8 bswap; /* byte swap data */ | ||
395 | u8 noflush; /* don't attempt flushes */ | 396 | u8 noflush; /* don't attempt flushes */ |
396 | u8 dsc_overlap; /* DSC overlap */ | 397 | u8 dsc_overlap; /* DSC overlap */ |
397 | u8 nice1; /* give potential excess bandwidth */ | 398 | u8 nice1; /* give potential excess bandwidth */ |
@@ -527,31 +528,26 @@ typedef struct hwif_s { | |||
527 | /* special host masking for drive selection */ | 528 | /* special host masking for drive selection */ |
528 | void (*maskproc)(ide_drive_t *, int); | 529 | void (*maskproc)(ide_drive_t *, int); |
529 | /* check host's drive quirk list */ | 530 | /* check host's drive quirk list */ |
530 | int (*quirkproc)(ide_drive_t *); | 531 | void (*quirkproc)(ide_drive_t *); |
531 | /* driver soft-power interface */ | 532 | /* driver soft-power interface */ |
532 | int (*busproc)(ide_drive_t *, int); | 533 | int (*busproc)(ide_drive_t *, int); |
533 | #endif | 534 | #endif |
534 | u8 (*mdma_filter)(ide_drive_t *); | 535 | u8 (*mdma_filter)(ide_drive_t *); |
535 | u8 (*udma_filter)(ide_drive_t *); | 536 | u8 (*udma_filter)(ide_drive_t *); |
536 | 537 | ||
537 | void (*fixup)(struct hwif_s *); | ||
538 | |||
539 | void (*ata_input_data)(ide_drive_t *, void *, u32); | 538 | void (*ata_input_data)(ide_drive_t *, void *, u32); |
540 | void (*ata_output_data)(ide_drive_t *, void *, u32); | 539 | void (*ata_output_data)(ide_drive_t *, void *, u32); |
541 | 540 | ||
542 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); | 541 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); |
543 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); | 542 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); |
544 | 543 | ||
544 | void (*dma_host_set)(ide_drive_t *, int); | ||
545 | int (*dma_setup)(ide_drive_t *); | 545 | int (*dma_setup)(ide_drive_t *); |
546 | void (*dma_exec_cmd)(ide_drive_t *, u8); | 546 | void (*dma_exec_cmd)(ide_drive_t *, u8); |
547 | void (*dma_start)(ide_drive_t *); | 547 | void (*dma_start)(ide_drive_t *); |
548 | int (*ide_dma_end)(ide_drive_t *drive); | 548 | int (*ide_dma_end)(ide_drive_t *drive); |
549 | int (*ide_dma_on)(ide_drive_t *drive); | ||
550 | void (*dma_off_quietly)(ide_drive_t *drive); | ||
551 | int (*ide_dma_test_irq)(ide_drive_t *drive); | 549 | int (*ide_dma_test_irq)(ide_drive_t *drive); |
552 | void (*ide_dma_clear_irq)(ide_drive_t *drive); | 550 | void (*ide_dma_clear_irq)(ide_drive_t *drive); |
553 | void (*dma_host_on)(ide_drive_t *drive); | ||
554 | void (*dma_host_off)(ide_drive_t *drive); | ||
555 | void (*dma_lost_irq)(ide_drive_t *drive); | 551 | void (*dma_lost_irq)(ide_drive_t *drive); |
556 | void (*dma_timeout)(ide_drive_t *drive); | 552 | void (*dma_timeout)(ide_drive_t *drive); |
557 | 553 | ||
@@ -874,14 +870,6 @@ extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); | |||
874 | 870 | ||
875 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 871 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); |
876 | 872 | ||
877 | /* | ||
878 | * Issue ATA command and wait for completion. | ||
879 | * Use for implementing commands in kernel | ||
880 | * | ||
881 | * (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) | ||
882 | */ | ||
883 | extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); | ||
884 | |||
885 | enum { | 873 | enum { |
886 | IDE_TFLAG_LBA48 = (1 << 0), | 874 | IDE_TFLAG_LBA48 = (1 << 0), |
887 | IDE_TFLAG_NO_SELECT_MASK = (1 << 1), | 875 | IDE_TFLAG_NO_SELECT_MASK = (1 << 1), |
@@ -934,6 +922,14 @@ enum { | |||
934 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | 922 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | |
935 | IDE_TFLAG_IN_LBA, | 923 | IDE_TFLAG_IN_LBA, |
936 | IDE_TFLAG_IN_DEVICE = (1 << 29), | 924 | IDE_TFLAG_IN_DEVICE = (1 << 29), |
925 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | ||
926 | IDE_TFLAG_IN_HOB, | ||
927 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | ||
928 | IDE_TFLAG_IN_TF, | ||
929 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | ||
930 | IDE_TFLAG_IN_DEVICE, | ||
931 | /* force 16-bit I/O operations */ | ||
932 | IDE_TFLAG_IO_16BIT = (1 << 30), | ||
937 | }; | 933 | }; |
938 | 934 | ||
939 | struct ide_taskfile { | 935 | struct ide_taskfile { |
@@ -988,6 +984,10 @@ void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | |||
988 | 984 | ||
989 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 985 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); |
990 | 986 | ||
987 | void task_end_request(ide_drive_t *, struct request *, u8); | ||
988 | |||
989 | u8 wait_drive_not_busy(ide_drive_t *); | ||
990 | |||
991 | int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); | 991 | int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); |
992 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); | 992 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); |
993 | 993 | ||
@@ -1015,10 +1015,9 @@ extern void do_ide_request(struct request_queue *); | |||
1015 | 1015 | ||
1016 | void ide_init_disk(struct gendisk *, ide_drive_t *); | 1016 | void ide_init_disk(struct gendisk *, ide_drive_t *); |
1017 | 1017 | ||
1018 | extern int ideprobe_init(void); | ||
1019 | |||
1020 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | 1018 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER |
1021 | extern void ide_scan_pcibus(int scan_direction) __init; | 1019 | extern int ide_scan_direction; |
1020 | int __init ide_scan_pcibus(void); | ||
1022 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); | 1021 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); |
1023 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) | 1022 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) |
1024 | #else | 1023 | #else |
@@ -1095,6 +1094,8 @@ enum { | |||
1095 | /* unmask IRQs */ | 1094 | /* unmask IRQs */ |
1096 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), | 1095 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), |
1097 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), | 1096 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), |
1097 | /* host is CY82C693 */ | ||
1098 | IDE_HFLAG_CY82C693 = (1 << 27), | ||
1098 | }; | 1099 | }; |
1099 | 1100 | ||
1100 | #ifdef CONFIG_BLK_DEV_OFFBOARD | 1101 | #ifdef CONFIG_BLK_DEV_OFFBOARD |
@@ -1109,7 +1110,6 @@ struct ide_port_info { | |||
1109 | void (*init_iops)(ide_hwif_t *); | 1110 | void (*init_iops)(ide_hwif_t *); |
1110 | void (*init_hwif)(ide_hwif_t *); | 1111 | void (*init_hwif)(ide_hwif_t *); |
1111 | void (*init_dma)(ide_hwif_t *, unsigned long); | 1112 | void (*init_dma)(ide_hwif_t *, unsigned long); |
1112 | void (*fixup)(ide_hwif_t *); | ||
1113 | ide_pci_enablebit_t enablebits[2]; | 1113 | ide_pci_enablebit_t enablebits[2]; |
1114 | hwif_chipset_t chipset; | 1114 | hwif_chipset_t chipset; |
1115 | u8 extra; | 1115 | u8 extra; |
@@ -1147,7 +1147,9 @@ static inline u8 ide_max_dma_mode(ide_drive_t *drive) | |||
1147 | return ide_find_dma_mode(drive, XFER_UDMA_6); | 1147 | return ide_find_dma_mode(drive, XFER_UDMA_6); |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | void ide_dma_off_quietly(ide_drive_t *); | ||
1150 | void ide_dma_off(ide_drive_t *); | 1151 | void ide_dma_off(ide_drive_t *); |
1152 | void ide_dma_on(ide_drive_t *); | ||
1151 | int ide_set_dma(ide_drive_t *); | 1153 | int ide_set_dma(ide_drive_t *); |
1152 | ide_startstop_t ide_dma_intr(ide_drive_t *); | 1154 | ide_startstop_t ide_dma_intr(ide_drive_t *); |
1153 | 1155 | ||
@@ -1158,10 +1160,7 @@ extern void ide_destroy_dmatable(ide_drive_t *); | |||
1158 | extern int ide_release_dma(ide_hwif_t *); | 1160 | extern int ide_release_dma(ide_hwif_t *); |
1159 | extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); | 1161 | extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); |
1160 | 1162 | ||
1161 | void ide_dma_host_off(ide_drive_t *); | 1163 | void ide_dma_host_set(ide_drive_t *, int); |
1162 | void ide_dma_off_quietly(ide_drive_t *); | ||
1163 | void ide_dma_host_on(ide_drive_t *); | ||
1164 | extern int __ide_dma_on(ide_drive_t *); | ||
1165 | extern int ide_dma_setup(ide_drive_t *); | 1164 | extern int ide_dma_setup(ide_drive_t *); |
1166 | extern void ide_dma_start(ide_drive_t *); | 1165 | extern void ide_dma_start(ide_drive_t *); |
1167 | extern int __ide_dma_end(ide_drive_t *); | 1166 | extern int __ide_dma_end(ide_drive_t *); |
@@ -1173,7 +1172,9 @@ extern void ide_dma_timeout(ide_drive_t *); | |||
1173 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } | 1172 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } |
1174 | static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } | 1173 | static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } |
1175 | static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } | 1174 | static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } |
1175 | static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; } | ||
1176 | static inline void ide_dma_off(ide_drive_t *drive) { ; } | 1176 | static inline void ide_dma_off(ide_drive_t *drive) { ; } |
1177 | static inline void ide_dma_on(ide_drive_t *drive) { ; } | ||
1177 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1178 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
1178 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1179 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
1179 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 1180 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
@@ -1203,8 +1204,9 @@ extern void ide_unregister (unsigned int index); | |||
1203 | void ide_register_region(struct gendisk *); | 1204 | void ide_register_region(struct gendisk *); |
1204 | void ide_unregister_region(struct gendisk *); | 1205 | void ide_unregister_region(struct gendisk *); |
1205 | 1206 | ||
1206 | void ide_undecoded_slave(ide_hwif_t *); | 1207 | void ide_undecoded_slave(ide_drive_t *); |
1207 | 1208 | ||
1209 | int ide_device_add_all(u8 *idx); | ||
1208 | int ide_device_add(u8 idx[4]); | 1210 | int ide_device_add(u8 idx[4]); |
1209 | 1211 | ||
1210 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) | 1212 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) |
@@ -1302,4 +1304,9 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) | |||
1302 | return &hwif->drives[(drive->dn ^ 1) & 1]; | 1304 | return &hwif->drives[(drive->dn ^ 1) & 1]; |
1303 | } | 1305 | } |
1304 | 1306 | ||
1307 | static inline void ide_set_irq(ide_drive_t *drive, int on) | ||
1308 | { | ||
1309 | drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); | ||
1310 | } | ||
1311 | |||
1305 | #endif /* _IDE_H */ | 1312 | #endif /* _IDE_H */ |