diff options
93 files changed, 1336 insertions, 2106 deletions
diff --git a/Documentation/ide/ide.txt b/Documentation/ide/ide.txt index 818676aad45a..486c699f4aea 100644 --- a/Documentation/ide/ide.txt +++ b/Documentation/ide/ide.txt | |||
| @@ -71,29 +71,6 @@ This driver automatically probes for most IDE interfaces (including all PCI | |||
| 71 | ones), for the drives/geometries attached to those interfaces, and for the IRQ | 71 | ones), for the drives/geometries attached to those interfaces, and for the IRQ |
| 72 | lines being used by the interfaces (normally 14, 15 for ide0/ide1). | 72 | lines being used by the interfaces (normally 14, 15 for ide0/ide1). |
| 73 | 73 | ||
| 74 | For special cases, interfaces may be specified using kernel "command line" | ||
| 75 | options. For example, | ||
| 76 | |||
| 77 | ide3=0x168,0x36e,10 /* ioports 0x168-0x16f,0x36e, irq 10 */ | ||
| 78 | |||
| 79 | Normally the irq number need not be specified, as ide.c will probe for it: | ||
| 80 | |||
| 81 | ide3=0x168,0x36e /* ioports 0x168-0x16f,0x36e */ | ||
| 82 | |||
| 83 | The standard port, and irq values are these: | ||
| 84 | |||
| 85 | ide0=0x1f0,0x3f6,14 | ||
| 86 | ide1=0x170,0x376,15 | ||
| 87 | ide2=0x1e8,0x3ee,11 | ||
| 88 | ide3=0x168,0x36e,10 | ||
| 89 | |||
| 90 | Note that the first parameter reserves 8 contiguous ioports, whereas the | ||
| 91 | second value denotes a single ioport. If in doubt, do a 'cat /proc/ioports'. | ||
| 92 | |||
| 93 | In all probability the device uses these ports and IRQs if it is attached | ||
| 94 | to the appropriate ide channel. Pass the parameter for the correct ide | ||
| 95 | channel to the kernel, as explained above. | ||
| 96 | |||
| 97 | Any number of interfaces may share a single IRQ if necessary, at a slight | 74 | Any number of interfaces may share a single IRQ if necessary, at a slight |
| 98 | performance penalty, whether on separate cards or a single VLB card. | 75 | performance penalty, whether on separate cards or a single VLB card. |
| 99 | The IDE driver automatically detects and handles this. However, this may | 76 | The IDE driver automatically detects and handles this. However, this may |
| @@ -184,13 +161,6 @@ provided it is mounted with the default block size of 1024 (as above). | |||
| 184 | Please pass on any feedback on any of this stuff to the maintainer, | 161 | Please pass on any feedback on any of this stuff to the maintainer, |
| 185 | whose address can be found in linux/MAINTAINERS. | 162 | whose address can be found in linux/MAINTAINERS. |
| 186 | 163 | ||
| 187 | Note that if BOTH hd.c and ide.c are configured into the kernel, | ||
| 188 | hd.c will normally be allowed to control the primary IDE interface. | ||
| 189 | This is useful for older hardware that may be incompatible with ide.c, | ||
| 190 | and still allows newer hardware to run on the 2nd/3rd/4th IDE ports | ||
| 191 | under control of ide.c. To have ide.c also "take over" the primary | ||
| 192 | IDE port in this situation, use the "command line" parameter: ide0=0x1f0 | ||
| 193 | |||
| 194 | The IDE driver is modularized. The high level disk/CD-ROM/tape/floppy | 164 | The IDE driver is modularized. The high level disk/CD-ROM/tape/floppy |
| 195 | drivers can always be compiled as loadable modules, the chipset drivers | 165 | drivers can always be compiled as loadable modules, the chipset drivers |
| 196 | can only be compiled into the kernel, and the core code (ide.c) can be | 166 | can only be compiled into the kernel, and the core code (ide.c) can be |
| @@ -206,7 +176,7 @@ When ide.c is used as a module, you can pass command line parameters to the | |||
| 206 | driver using the "options=" keyword to insmod, while replacing any ',' with | 176 | driver using the "options=" keyword to insmod, while replacing any ',' with |
| 207 | ';'. For example: | 177 | ';'. For example: |
| 208 | 178 | ||
| 209 | insmod ide.o options="ide0=serialize ide1=serialize ide2=0x1e8;0x3ee;11" | 179 | insmod ide.o options="hda=nodma hdb=nodma" |
| 210 | 180 | ||
| 211 | 181 | ||
| 212 | ================================================================================ | 182 | ================================================================================ |
| @@ -247,21 +217,11 @@ Summary of ide driver parameters for kernel command line | |||
| 247 | As for VLB, it is safest to not specify it. | 217 | As for VLB, it is safest to not specify it. |
| 248 | Bigger values are safer than smaller ones. | 218 | Bigger values are safer than smaller ones. |
| 249 | 219 | ||
| 250 | "idex=base" : probe for an interface at the addr specified, | ||
| 251 | where "base" is usually 0x1f0 or 0x170 | ||
| 252 | and "ctl" is assumed to be "base"+0x206 | ||
| 253 | |||
| 254 | "idex=base,ctl" : specify both base and ctl | ||
| 255 | |||
| 256 | "idex=base,ctl,irq" : specify base, ctl, and irq number | ||
| 257 | |||
| 258 | "idex=serialize" : do not overlap operations on idex. Please note | 220 | "idex=serialize" : do not overlap operations on idex. Please note |
| 259 | that you will have to specify this option for | 221 | that you will have to specify this option for |
| 260 | both the respective primary and secondary channel | 222 | both the respective primary and secondary channel |
| 261 | to take effect. | 223 | to take effect. |
| 262 | 224 | ||
| 263 | "idex=four" : four drives on idex and ide(x^1) share same ports | ||
| 264 | |||
| 265 | "idex=reset" : reset interface after probe | 225 | "idex=reset" : reset interface after probe |
| 266 | 226 | ||
| 267 | "idex=ata66" : informs the interface that it has an 80c cable | 227 | "idex=ata66" : informs the interface that it has an 80c cable |
| @@ -269,8 +229,6 @@ Summary of ide driver parameters for kernel command line | |||
| 269 | ability to bit test for detection is currently | 229 | ability to bit test for detection is currently |
| 270 | unknown. | 230 | unknown. |
| 271 | 231 | ||
| 272 | "ide=reverse" : formerly called to pci sub-system, but now local. | ||
| 273 | |||
| 274 | "ide=doubler" : probe/support IDE doublers on Amiga | 232 | "ide=doubler" : probe/support IDE doublers on Amiga |
| 275 | 233 | ||
| 276 | There may be more options than shown -- use the source, Luke! | 234 | There may be more options than shown -- use the source, Luke! |
| @@ -290,6 +248,9 @@ Also for legacy CMD640 host driver (cmd640) you need to use "probe_vlb" | |||
| 290 | kernel paremeter to enable probing for VLB version of the chipset (PCI ones | 248 | kernel paremeter to enable probing for VLB version of the chipset (PCI ones |
| 291 | are detected automatically). | 249 | are detected automatically). |
| 292 | 250 | ||
| 251 | You also need to use "probe" kernel parameter for ide-4drives driver | ||
| 252 | (support for IDE generic chipset with four drives on one port). | ||
| 253 | |||
| 293 | ================================================================================ | 254 | ================================================================================ |
| 294 | 255 | ||
| 295 | Some Terminology | 256 | Some Terminology |
diff --git a/Documentation/ide/warm-plug-howto.txt b/Documentation/ide/warm-plug-howto.txt new file mode 100644 index 000000000000..d5885468b072 --- /dev/null +++ b/Documentation/ide/warm-plug-howto.txt | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | |||
| 2 | IDE warm-plug HOWTO | ||
| 3 | =================== | ||
| 4 | |||
| 5 | To warm-plug devices on a port 'idex': | ||
| 6 | |||
| 7 | # echo -n "1" > /sys/class/ide_port/idex/delete_devices | ||
| 8 | |||
| 9 | unplug old device(s) and plug new device(s) | ||
| 10 | |||
| 11 | # echo -n "1" > /sys/class/ide_port/idex/scan | ||
| 12 | |||
| 13 | done | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index c867f506366d..cd6f464b919c 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -763,11 +763,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 763 | Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]] | 763 | Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]] |
| 764 | 764 | ||
| 765 | ide= [HW] (E)IDE subsystem | 765 | ide= [HW] (E)IDE subsystem |
| 766 | Format: ide=nodma or ide=doubler or ide=reverse | 766 | Format: ide=nodma or ide=doubler |
| 767 | See Documentation/ide/ide.txt. | 767 | See Documentation/ide/ide.txt. |
| 768 | 768 | ||
| 769 | ide?= [HW] (E)IDE subsystem | 769 | ide?= [HW] (E)IDE subsystem |
| 770 | Format: ide?=noprobe or chipset specific parameters. | 770 | Format: ide?=ata66 or chipset specific parameters. |
| 771 | See Documentation/ide/ide.txt. | 771 | See Documentation/ide/ide.txt. |
| 772 | 772 | ||
| 773 | idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed | 773 | idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed |
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index cd870a823d18..06d918d94dd1 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
| @@ -10,9 +10,6 @@ | |||
| 10 | #include <linux/reboot.h> | 10 | #include <linux/reboot.h> |
| 11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
| 12 | #include <linux/initrd.h> | 12 | #include <linux/initrd.h> |
| 13 | #if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE) | ||
| 14 | #include <linux/ide.h> | ||
| 15 | #endif | ||
| 16 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
| 17 | #include <linux/bootmem.h> | 14 | #include <linux/bootmem.h> |
| 18 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
| @@ -51,11 +48,6 @@ | |||
| 51 | 48 | ||
| 52 | extern void bootx_init(unsigned long r4, unsigned long phys); | 49 | extern void bootx_init(unsigned long r4, unsigned long phys); |
| 53 | 50 | ||
| 54 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 55 | struct ide_machdep_calls ppc_ide_md; | ||
| 56 | EXPORT_SYMBOL(ppc_ide_md); | ||
| 57 | #endif | ||
| 58 | |||
| 59 | int boot_cpuid; | 51 | int boot_cpuid; |
| 60 | EXPORT_SYMBOL_GPL(boot_cpuid); | 52 | EXPORT_SYMBOL_GPL(boot_cpuid); |
| 61 | int boot_cpuid_phys; | 53 | int boot_cpuid_phys; |
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index 1c58db9d42cb..bcf50d7056e9 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
| @@ -1144,28 +1144,6 @@ void __init pmac_pcibios_after_init(void) | |||
| 1144 | { | 1144 | { |
| 1145 | struct device_node* nd; | 1145 | struct device_node* nd; |
| 1146 | 1146 | ||
| 1147 | #ifdef CONFIG_BLK_DEV_IDE | ||
| 1148 | struct pci_dev *dev = NULL; | ||
| 1149 | |||
| 1150 | /* OF fails to initialize IDE controllers on macs | ||
| 1151 | * (and maybe other machines) | ||
| 1152 | * | ||
| 1153 | * Ideally, this should be moved to the IDE layer, but we need | ||
| 1154 | * to check specifically with Andre Hedrick how to do it cleanly | ||
| 1155 | * since the common IDE code seem to care about the fact that the | ||
| 1156 | * BIOS may have disabled a controller. | ||
| 1157 | * | ||
| 1158 | * -- BenH | ||
| 1159 | */ | ||
| 1160 | for_each_pci_dev(dev) { | ||
| 1161 | if ((dev->class >> 16) != PCI_BASE_CLASS_STORAGE) | ||
| 1162 | continue; | ||
| 1163 | if (pci_enable_device(dev)) | ||
| 1164 | printk(KERN_WARNING | ||
| 1165 | "pci: Failed to enable %s\n", pci_name(dev)); | ||
| 1166 | } | ||
| 1167 | #endif /* CONFIG_BLK_DEV_IDE */ | ||
| 1168 | |||
| 1169 | for_each_node_by_name(nd, "firewire") { | 1147 | for_each_node_by_name(nd, "firewire") { |
| 1170 | if (nd->parent && (of_device_is_compatible(nd, "pci106b,18") || | 1148 | if (nd->parent && (of_device_is_compatible(nd, "pci106b,18") || |
| 1171 | of_device_is_compatible(nd, "pci106b,30") || | 1149 | of_device_is_compatible(nd, "pci106b,30") || |
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index b3abaaf61eb4..3362e781b6a7 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | #define __PMAC_H__ | 2 | #define __PMAC_H__ |
| 3 | 3 | ||
| 4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
| 5 | #include <linux/ide.h> | ||
| 6 | #include <linux/irq.h> | 5 | #include <linux/irq.h> |
| 7 | 6 | ||
| 8 | /* | 7 | /* |
| @@ -35,10 +34,6 @@ extern void pmac_check_ht_link(void); | |||
| 35 | 34 | ||
| 36 | extern void pmac_setup_smp(void); | 35 | extern void pmac_setup_smp(void); |
| 37 | 36 | ||
| 38 | extern unsigned long pmac_ide_get_base(int index); | ||
| 39 | extern void pmac_ide_init_hwif_ports(hw_regs_t *hw, | ||
| 40 | unsigned long data_port, unsigned long ctrl_port, int *irq); | ||
| 41 | |||
| 42 | extern int pmac_nvram_init(void); | 37 | extern int pmac_nvram_init(void); |
| 43 | extern void pmac_pic_init(void); | 38 | extern void pmac_pic_init(void); |
| 44 | 39 | ||
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 36ff1b6b7fac..2693fc371eab 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
| @@ -574,14 +574,6 @@ static int __init pmac_probe(void) | |||
| 574 | ISA_DMA_THRESHOLD = ~0L; | 574 | ISA_DMA_THRESHOLD = ~0L; |
| 575 | DMA_MODE_READ = 1; | 575 | DMA_MODE_READ = 1; |
| 576 | DMA_MODE_WRITE = 2; | 576 | DMA_MODE_WRITE = 2; |
| 577 | |||
| 578 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 579 | #ifdef CONFIG_BLK_DEV_IDE_PMAC | ||
| 580 | ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports; | ||
| 581 | ppc_ide_md.default_io_base = pmac_ide_get_base; | ||
| 582 | #endif /* CONFIG_BLK_DEV_IDE_PMAC */ | ||
| 583 | #endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */ | ||
| 584 | |||
| 585 | #endif /* CONFIG_PPC32 */ | 577 | #endif /* CONFIG_PPC32 */ |
| 586 | 578 | ||
| 587 | #ifdef CONFIG_PMAC_SMU | 579 | #ifdef CONFIG_PMAC_SMU |
diff --git a/arch/ppc/configs/sandpoint_defconfig b/arch/ppc/configs/sandpoint_defconfig index fb493a67c60d..9525e34138fc 100644 --- a/arch/ppc/configs/sandpoint_defconfig +++ b/arch/ppc/configs/sandpoint_defconfig | |||
| @@ -189,7 +189,7 @@ CONFIG_IDE_TASKFILE_IO=y | |||
| 189 | # | 189 | # |
| 190 | # IDE chipset support/bugfixes | 190 | # IDE chipset support/bugfixes |
| 191 | # | 191 | # |
| 192 | CONFIG_IDE_GENERIC=y | 192 | CONFIG_BLK_DEV_SL82C105=y |
| 193 | # CONFIG_BLK_DEV_IDEPCI is not set | 193 | # CONFIG_BLK_DEV_IDEPCI is not set |
| 194 | # CONFIG_BLK_DEV_IDEDMA is not set | 194 | # CONFIG_BLK_DEV_IDEDMA is not set |
| 195 | # CONFIG_IDEDMA_AUTO is not set | 195 | # CONFIG_IDEDMA_AUTO is not set |
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index c35350250cfc..2ba659f401be 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
| 13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
| 14 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
| 15 | #include <linux/ide.h> | ||
| 16 | #include <linux/pm.h> | 15 | #include <linux/pm.h> |
| 17 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
| 18 | 17 | ||
| @@ -124,10 +123,6 @@ EXPORT_SYMBOL(__ioremap); | |||
| 124 | EXPORT_SYMBOL(iounmap); | 123 | EXPORT_SYMBOL(iounmap); |
| 125 | EXPORT_SYMBOL(ioremap_bot); /* aka VMALLOC_END */ | 124 | EXPORT_SYMBOL(ioremap_bot); /* aka VMALLOC_END */ |
| 126 | 125 | ||
| 127 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 128 | EXPORT_SYMBOL(ppc_ide_md); | ||
| 129 | #endif | ||
| 130 | |||
| 131 | #ifdef CONFIG_PCI | 126 | #ifdef CONFIG_PCI |
| 132 | EXPORT_SYMBOL(isa_io_base); | 127 | EXPORT_SYMBOL(isa_io_base); |
| 133 | EXPORT_SYMBOL(isa_mem_base); | 128 | EXPORT_SYMBOL(isa_mem_base); |
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c index 294055902f0c..bfddfdee0b65 100644 --- a/arch/ppc/kernel/setup.c +++ b/arch/ppc/kernel/setup.c | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | #include <linux/reboot.h> | 10 | #include <linux/reboot.h> |
| 11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
| 12 | #include <linux/initrd.h> | 12 | #include <linux/initrd.h> |
| 13 | #include <linux/ide.h> | ||
| 14 | #include <linux/screen_info.h> | 13 | #include <linux/screen_info.h> |
| 15 | #include <linux/bootmem.h> | 14 | #include <linux/bootmem.h> |
| 16 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
| @@ -57,7 +56,6 @@ extern void ppc6xx_idle(void); | |||
| 57 | extern void power4_idle(void); | 56 | extern void power4_idle(void); |
| 58 | 57 | ||
| 59 | extern boot_infos_t *boot_infos; | 58 | extern boot_infos_t *boot_infos; |
| 60 | struct ide_machdep_calls ppc_ide_md; | ||
| 61 | 59 | ||
| 62 | /* Used with the BI_MEMSIZE bootinfo parameter to store the memory | 60 | /* Used with the BI_MEMSIZE bootinfo parameter to store the memory |
| 63 | size value reported by the boot loader. */ | 61 | size value reported by the boot loader. */ |
diff --git a/arch/ppc/platforms/4xx/bamboo.c b/arch/ppc/platforms/4xx/bamboo.c index 017623c9bc4b..01f20f4c14fe 100644 --- a/arch/ppc/platforms/4xx/bamboo.c +++ b/arch/ppc/platforms/4xx/bamboo.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/blkdev.h> | 22 | #include <linux/blkdev.h> |
| 23 | #include <linux/console.h> | 23 | #include <linux/console.h> |
| 24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
| 25 | #include <linux/ide.h> | ||
| 26 | #include <linux/initrd.h> | 25 | #include <linux/initrd.h> |
| 27 | #include <linux/seq_file.h> | 26 | #include <linux/seq_file.h> |
| 28 | #include <linux/root_dev.h> | 27 | #include <linux/root_dev.h> |
diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c index 453643a0eeea..8027a36fc5bb 100644 --- a/arch/ppc/platforms/4xx/ebony.c +++ b/arch/ppc/platforms/4xx/ebony.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #include <linux/blkdev.h> | 25 | #include <linux/blkdev.h> |
| 26 | #include <linux/console.h> | 26 | #include <linux/console.h> |
| 27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
| 28 | #include <linux/ide.h> | ||
| 29 | #include <linux/initrd.h> | 28 | #include <linux/initrd.h> |
| 30 | #include <linux/seq_file.h> | 29 | #include <linux/seq_file.h> |
| 31 | #include <linux/root_dev.h> | 30 | #include <linux/root_dev.h> |
diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c index b79ebb8a3e6c..f6d8c2e8b6b7 100644 --- a/arch/ppc/platforms/4xx/luan.c +++ b/arch/ppc/platforms/4xx/luan.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
| 24 | #include <linux/console.h> | 24 | #include <linux/console.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/ide.h> | ||
| 27 | #include <linux/initrd.h> | 26 | #include <linux/initrd.h> |
| 28 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
| 29 | #include <linux/root_dev.h> | 28 | #include <linux/root_dev.h> |
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c index 28a712cd4800..308386ef6f77 100644 --- a/arch/ppc/platforms/4xx/ocotea.c +++ b/arch/ppc/platforms/4xx/ocotea.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
| 24 | #include <linux/console.h> | 24 | #include <linux/console.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/ide.h> | ||
| 27 | #include <linux/initrd.h> | 26 | #include <linux/initrd.h> |
| 28 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
| 29 | #include <linux/root_dev.h> | 28 | #include <linux/root_dev.h> |
diff --git a/arch/ppc/platforms/4xx/taishan.c b/arch/ppc/platforms/4xx/taishan.c index f6a0c6650f33..115694275083 100644 --- a/arch/ppc/platforms/4xx/taishan.c +++ b/arch/ppc/platforms/4xx/taishan.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
| 24 | #include <linux/console.h> | 24 | #include <linux/console.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/ide.h> | ||
| 27 | #include <linux/initrd.h> | 26 | #include <linux/initrd.h> |
| 28 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
| 29 | #include <linux/root_dev.h> | 28 | #include <linux/root_dev.h> |
diff --git a/arch/ppc/platforms/4xx/yucca.c b/arch/ppc/platforms/4xx/yucca.c index 66a44ff0d926..f6cfd44281fc 100644 --- a/arch/ppc/platforms/4xx/yucca.c +++ b/arch/ppc/platforms/4xx/yucca.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <linux/blkdev.h> | 24 | #include <linux/blkdev.h> |
| 25 | #include <linux/console.h> | 25 | #include <linux/console.h> |
| 26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
| 27 | #include <linux/ide.h> | ||
| 28 | #include <linux/initrd.h> | 27 | #include <linux/initrd.h> |
| 29 | #include <linux/seq_file.h> | 28 | #include <linux/seq_file.h> |
| 30 | #include <linux/root_dev.h> | 29 | #include <linux/root_dev.h> |
diff --git a/arch/ppc/platforms/chestnut.c b/arch/ppc/platforms/chestnut.c index dcd6070b85eb..27c140f218ed 100644 --- a/arch/ppc/platforms/chestnut.c +++ b/arch/ppc/platforms/chestnut.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/initrd.h> | 22 | #include <linux/initrd.h> |
| 23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
| 25 | #include <linux/ide.h> | ||
| 26 | #include <linux/serial.h> | 25 | #include <linux/serial.h> |
| 27 | #include <linux/serial_core.h> | 26 | #include <linux/serial_core.h> |
| 28 | #include <linux/serial_8250.h> | 27 | #include <linux/serial_8250.h> |
diff --git a/arch/ppc/platforms/cpci690.c b/arch/ppc/platforms/cpci690.c index e78bccf96c9d..07f672d58767 100644 --- a/arch/ppc/platforms/cpci690.c +++ b/arch/ppc/platforms/cpci690.c | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | */ | 10 | */ |
| 11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
| 12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
| 13 | #include <linux/ide.h> | ||
| 14 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
| 15 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
| 16 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
diff --git a/arch/ppc/platforms/ev64260.c b/arch/ppc/platforms/ev64260.c index c1f77e1d368e..f522b31c46d7 100644 --- a/arch/ppc/platforms/ev64260.c +++ b/arch/ppc/platforms/ev64260.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | 23 | ||
| 24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
| 25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
| 26 | #include <linux/ide.h> | ||
| 27 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
| 28 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
| 29 | #include <linux/seq_file.h> | 28 | #include <linux/seq_file.h> |
diff --git a/arch/ppc/platforms/hdpu.c b/arch/ppc/platforms/hdpu.c index ca5de13712fd..904b518c152e 100644 --- a/arch/ppc/platforms/hdpu.c +++ b/arch/ppc/platforms/hdpu.c | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
| 17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
| 18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
| 19 | #include <linux/ide.h> | ||
| 20 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
| 21 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| 22 | 21 | ||
| @@ -604,41 +603,6 @@ static void parse_bootinfo(unsigned long r3, | |||
| 604 | } | 603 | } |
| 605 | } | 604 | } |
| 606 | 605 | ||
| 607 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 608 | static void | ||
| 609 | hdpu_ide_request_region(ide_ioreg_t from, unsigned int extent, const char *name) | ||
| 610 | { | ||
| 611 | request_region(from, extent, name); | ||
| 612 | return; | ||
| 613 | } | ||
| 614 | |||
| 615 | static void hdpu_ide_release_region(ide_ioreg_t from, unsigned int extent) | ||
| 616 | { | ||
| 617 | release_region(from, extent); | ||
| 618 | return; | ||
| 619 | } | ||
| 620 | |||
| 621 | static void __init | ||
| 622 | hdpu_ide_pci_init_hwif_ports(hw_regs_t * hw, ide_ioreg_t data_port, | ||
| 623 | ide_ioreg_t ctrl_port, int *irq) | ||
| 624 | { | ||
| 625 | struct pci_dev *dev; | ||
| 626 | |||
| 627 | pci_for_each_dev(dev) { | ||
| 628 | if (((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) || | ||
| 629 | ((dev->class >> 8) == PCI_CLASS_STORAGE_RAID)) { | ||
| 630 | hw->irq = dev->irq; | ||
| 631 | |||
| 632 | if (irq != NULL) { | ||
| 633 | *irq = dev->irq; | ||
| 634 | } | ||
| 635 | } | ||
| 636 | } | ||
| 637 | |||
| 638 | return; | ||
| 639 | } | ||
| 640 | #endif | ||
| 641 | |||
| 642 | void hdpu_heartbeat(void) | 606 | void hdpu_heartbeat(void) |
| 643 | { | 607 | { |
| 644 | if (mv64x60_read(&bh, MV64x60_GPP_VALUE) & (1 << 5)) | 608 | if (mv64x60_read(&bh, MV64x60_GPP_VALUE) & (1 << 5)) |
diff --git a/arch/ppc/platforms/lopec.c b/arch/ppc/platforms/lopec.c index b947c774f524..1e3aa6e9b6c7 100644 --- a/arch/ppc/platforms/lopec.c +++ b/arch/ppc/platforms/lopec.c | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include <linux/pci_ids.h> | 15 | #include <linux/pci_ids.h> |
| 16 | #include <linux/ioport.h> | 16 | #include <linux/ioport.h> |
| 17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 18 | #include <linux/ide.h> | ||
| 19 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
| 20 | #include <linux/initrd.h> | 19 | #include <linux/initrd.h> |
| 21 | #include <linux/console.h> | 20 | #include <linux/console.h> |
| @@ -168,85 +167,6 @@ lopec_power_off(void) | |||
| 168 | lopec_halt(); | 167 | lopec_halt(); |
| 169 | } | 168 | } |
| 170 | 169 | ||
| 171 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 172 | int lopec_ide_ports_known = 0; | ||
| 173 | static unsigned long lopec_ide_regbase[MAX_HWIFS]; | ||
| 174 | static unsigned long lopec_ide_ctl_regbase[MAX_HWIFS]; | ||
| 175 | static unsigned long lopec_idedma_regbase; | ||
| 176 | |||
| 177 | static void | ||
| 178 | lopec_ide_probe(void) | ||
| 179 | { | ||
| 180 | struct pci_dev *dev = pci_get_device(PCI_VENDOR_ID_WINBOND, | ||
| 181 | PCI_DEVICE_ID_WINBOND_82C105, | ||
| 182 | NULL); | ||
| 183 | lopec_ide_ports_known = 1; | ||
| 184 | |||
| 185 | if (dev) { | ||
| 186 | lopec_ide_regbase[0] = dev->resource[0].start; | ||
| 187 | lopec_ide_regbase[1] = dev->resource[2].start; | ||
| 188 | lopec_ide_ctl_regbase[0] = dev->resource[1].start; | ||
| 189 | lopec_ide_ctl_regbase[1] = dev->resource[3].start; | ||
| 190 | lopec_idedma_regbase = dev->resource[4].start; | ||
| 191 | pci_dev_put(dev); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | static int | ||
| 196 | lopec_ide_default_irq(unsigned long base) | ||
| 197 | { | ||
| 198 | if (lopec_ide_ports_known == 0) | ||
| 199 | lopec_ide_probe(); | ||
| 200 | |||
| 201 | if (base == lopec_ide_regbase[0]) | ||
| 202 | return 14; | ||
| 203 | else if (base == lopec_ide_regbase[1]) | ||
| 204 | return 15; | ||
| 205 | else | ||
| 206 | return 0; | ||
| 207 | } | ||
| 208 | |||
| 209 | static unsigned long | ||
| 210 | lopec_ide_default_io_base(int index) | ||
| 211 | { | ||
| 212 | if (lopec_ide_ports_known == 0) | ||
| 213 | lopec_ide_probe(); | ||
| 214 | return lopec_ide_regbase[index]; | ||
| 215 | } | ||
| 216 | |||
| 217 | static void __init | ||
| 218 | lopec_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data, | ||
| 219 | unsigned long ctl, int *irq) | ||
| 220 | { | ||
| 221 | unsigned long reg = data; | ||
| 222 | uint alt_status_base; | ||
| 223 | int i; | ||
| 224 | |||
| 225 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) | ||
| 226 | hw->io_ports[i] = reg++; | ||
| 227 | |||
| 228 | if (data == lopec_ide_regbase[0]) { | ||
| 229 | alt_status_base = lopec_ide_ctl_regbase[0] + 2; | ||
| 230 | hw->irq = 14; | ||
| 231 | } else if (data == lopec_ide_regbase[1]) { | ||
| 232 | alt_status_base = lopec_ide_ctl_regbase[1] + 2; | ||
| 233 | hw->irq = 15; | ||
| 234 | } else { | ||
| 235 | alt_status_base = 0; | ||
| 236 | hw->irq = 0; | ||
| 237 | } | ||
| 238 | |||
| 239 | if (ctl) | ||
| 240 | hw->io_ports[IDE_CONTROL_OFFSET] = ctl; | ||
| 241 | else | ||
| 242 | hw->io_ports[IDE_CONTROL_OFFSET] = alt_status_base; | ||
| 243 | |||
| 244 | if (irq != NULL) | ||
| 245 | *irq = hw->irq; | ||
| 246 | |||
| 247 | } | ||
| 248 | #endif /* BLK_DEV_IDE */ | ||
| 249 | |||
| 250 | static void __init | 170 | static void __init |
| 251 | lopec_init_IRQ(void) | 171 | lopec_init_IRQ(void) |
| 252 | { | 172 | { |
| @@ -384,11 +304,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
| 384 | ppc_md.nvram_read_val = todc_direct_read_val; | 304 | ppc_md.nvram_read_val = todc_direct_read_val; |
| 385 | ppc_md.nvram_write_val = todc_direct_write_val; | 305 | ppc_md.nvram_write_val = todc_direct_write_val; |
| 386 | 306 | ||
| 387 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 388 | ppc_ide_md.default_irq = lopec_ide_default_irq; | ||
| 389 | ppc_ide_md.default_io_base = lopec_ide_default_io_base; | ||
| 390 | ppc_ide_md.ide_init_hwif = lopec_ide_init_hwif_ports; | ||
| 391 | #endif | ||
| 392 | #ifdef CONFIG_SERIAL_TEXT_DEBUG | 307 | #ifdef CONFIG_SERIAL_TEXT_DEBUG |
| 393 | ppc_md.progress = gen550_progress; | 308 | ppc_md.progress = gen550_progress; |
| 394 | #endif | 309 | #endif |
diff --git a/arch/ppc/platforms/mvme5100.c b/arch/ppc/platforms/mvme5100.c index bb8d4a45437a..053b54ac88f2 100644 --- a/arch/ppc/platforms/mvme5100.c +++ b/arch/ppc/platforms/mvme5100.c | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | #include <linux/initrd.h> | 17 | #include <linux/initrd.h> |
| 18 | #include <linux/console.h> | 18 | #include <linux/console.h> |
| 19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
| 20 | #include <linux/ide.h> | ||
| 21 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
| 22 | #include <linux/kdev_t.h> | 21 | #include <linux/kdev_t.h> |
| 23 | #include <linux/root_dev.h> | 22 | #include <linux/root_dev.h> |
diff --git a/arch/ppc/platforms/powerpmc250.c b/arch/ppc/platforms/powerpmc250.c index 4d46650e07fd..162dc85ff7be 100644 --- a/arch/ppc/platforms/powerpmc250.c +++ b/arch/ppc/platforms/powerpmc250.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
| 28 | #include <linux/ide.h> | ||
| 29 | #include <linux/root_dev.h> | 28 | #include <linux/root_dev.h> |
| 30 | 29 | ||
| 31 | #include <asm/byteorder.h> | 30 | #include <asm/byteorder.h> |
diff --git a/arch/ppc/platforms/pplus.c b/arch/ppc/platforms/pplus.c index 8a1788c48155..cbcac85c7a78 100644 --- a/arch/ppc/platforms/pplus.c +++ b/arch/ppc/platforms/pplus.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/ioport.h> | 19 | #include <linux/ioport.h> |
| 20 | #include <linux/console.h> | 20 | #include <linux/console.h> |
| 21 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
| 22 | #include <linux/ide.h> | ||
| 23 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
| 24 | #include <linux/root_dev.h> | 23 | #include <linux/root_dev.h> |
| 25 | 24 | ||
| @@ -668,57 +667,6 @@ static void __init pplus_init_IRQ(void) | |||
| 668 | ppc_md.progress("init_irq: exit", 0); | 667 | ppc_md.progress("init_irq: exit", 0); |
| 669 | } | 668 | } |
| 670 | 669 | ||
| 671 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 672 | /* | ||
| 673 | * IDE stuff. | ||
| 674 | */ | ||
| 675 | static int pplus_ide_default_irq(unsigned long base) | ||
| 676 | { | ||
| 677 | switch (base) { | ||
| 678 | case 0x1f0: | ||
| 679 | return 14; | ||
| 680 | case 0x170: | ||
| 681 | return 15; | ||
| 682 | default: | ||
| 683 | return 0; | ||
| 684 | } | ||
| 685 | } | ||
| 686 | |||
| 687 | static unsigned long pplus_ide_default_io_base(int index) | ||
| 688 | { | ||
| 689 | switch (index) { | ||
| 690 | case 0: | ||
| 691 | return 0x1f0; | ||
| 692 | case 1: | ||
| 693 | return 0x170; | ||
| 694 | default: | ||
| 695 | return 0; | ||
| 696 | } | ||
| 697 | } | ||
| 698 | |||
| 699 | static void __init | ||
| 700 | pplus_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port, | ||
| 701 | unsigned long ctrl_port, int *irq) | ||
| 702 | { | ||
| 703 | unsigned long reg = data_port; | ||
| 704 | int i; | ||
| 705 | |||
| 706 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { | ||
| 707 | hw->io_ports[i] = reg; | ||
| 708 | reg += 1; | ||
| 709 | } | ||
| 710 | |||
| 711 | if (ctrl_port) | ||
| 712 | hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; | ||
| 713 | else | ||
| 714 | hw->io_ports[IDE_CONTROL_OFFSET] = | ||
| 715 | hw->io_ports[IDE_DATA_OFFSET] + 0x206; | ||
| 716 | |||
| 717 | if (irq != NULL) | ||
| 718 | *irq = pplus_ide_default_irq(data_port); | ||
| 719 | } | ||
| 720 | #endif | ||
| 721 | |||
| 722 | #ifdef CONFIG_SMP | 670 | #ifdef CONFIG_SMP |
| 723 | /* PowerPlus (MTX) support */ | 671 | /* PowerPlus (MTX) support */ |
| 724 | static int __init smp_pplus_probe(void) | 672 | static int __init smp_pplus_probe(void) |
| @@ -884,12 +832,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
| 884 | ppc_md.find_end_of_memory = pplus_find_end_of_memory; | 832 | ppc_md.find_end_of_memory = pplus_find_end_of_memory; |
| 885 | ppc_md.setup_io_mappings = pplus_map_io; | 833 | ppc_md.setup_io_mappings = pplus_map_io; |
| 886 | 834 | ||
| 887 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 888 | ppc_ide_md.default_irq = pplus_ide_default_irq; | ||
| 889 | ppc_ide_md.default_io_base = pplus_ide_default_io_base; | ||
| 890 | ppc_ide_md.ide_init_hwif = pplus_ide_init_hwif_ports; | ||
| 891 | #endif | ||
| 892 | |||
| 893 | #ifdef CONFIG_SERIAL_TEXT_DEBUG | 835 | #ifdef CONFIG_SERIAL_TEXT_DEBUG |
| 894 | ppc_md.progress = gen550_progress; | 836 | ppc_md.progress = gen550_progress; |
| 895 | #endif /* CONFIG_SERIAL_TEXT_DEBUG */ | 837 | #endif /* CONFIG_SERIAL_TEXT_DEBUG */ |
diff --git a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c index 38449855d5ff..465b658c927d 100644 --- a/arch/ppc/platforms/prep_setup.c +++ b/arch/ppc/platforms/prep_setup.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <linux/console.h> | 33 | #include <linux/console.h> |
| 34 | #include <linux/timex.h> | 34 | #include <linux/timex.h> |
| 35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
| 36 | #include <linux/ide.h> | ||
| 37 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
| 38 | #include <linux/root_dev.h> | 37 | #include <linux/root_dev.h> |
| 39 | 38 | ||
| @@ -894,38 +893,6 @@ prep_init_IRQ(void) | |||
| 894 | i8259_init(MPC10X_MAPA_PCI_INTACK_ADDR, 0); | 893 | i8259_init(MPC10X_MAPA_PCI_INTACK_ADDR, 0); |
| 895 | } | 894 | } |
| 896 | 895 | ||
| 897 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 898 | /* | ||
| 899 | * IDE stuff. | ||
| 900 | */ | ||
| 901 | static int | ||
| 902 | prep_ide_default_irq(unsigned long base) | ||
| 903 | { | ||
| 904 | switch (base) { | ||
| 905 | case 0x1f0: return 13; | ||
| 906 | case 0x170: return 13; | ||
| 907 | case 0x1e8: return 11; | ||
| 908 | case 0x168: return 10; | ||
| 909 | case 0xfff0: return 14; /* MCP(N)750 ide0 */ | ||
| 910 | case 0xffe0: return 15; /* MCP(N)750 ide1 */ | ||
| 911 | default: return 0; | ||
| 912 | } | ||
| 913 | } | ||
| 914 | |||
| 915 | static unsigned long | ||
| 916 | prep_ide_default_io_base(int index) | ||
| 917 | { | ||
| 918 | switch (index) { | ||
| 919 | case 0: return 0x1f0; | ||
| 920 | case 1: return 0x170; | ||
| 921 | case 2: return 0x1e8; | ||
| 922 | case 3: return 0x168; | ||
| 923 | default: | ||
| 924 | return 0; | ||
| 925 | } | ||
| 926 | } | ||
| 927 | #endif | ||
| 928 | |||
| 929 | #ifdef CONFIG_SMP | 896 | #ifdef CONFIG_SMP |
| 930 | /* PReP (MTX) support */ | 897 | /* PReP (MTX) support */ |
| 931 | static int __init | 898 | static int __init |
| @@ -1070,11 +1037,6 @@ prep_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
| 1070 | 1037 | ||
| 1071 | ppc_md.setup_io_mappings = prep_map_io; | 1038 | ppc_md.setup_io_mappings = prep_map_io; |
| 1072 | 1039 | ||
| 1073 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 1074 | ppc_ide_md.default_irq = prep_ide_default_irq; | ||
| 1075 | ppc_ide_md.default_io_base = prep_ide_default_io_base; | ||
| 1076 | #endif | ||
| 1077 | |||
| 1078 | #ifdef CONFIG_SMP | 1040 | #ifdef CONFIG_SMP |
| 1079 | smp_ops = &prep_smp_ops; | 1041 | smp_ops = &prep_smp_ops; |
| 1080 | #endif /* CONFIG_SMP */ | 1042 | #endif /* CONFIG_SMP */ |
diff --git a/arch/ppc/platforms/prpmc750.c b/arch/ppc/platforms/prpmc750.c index fcab513e206d..93bd593cf957 100644 --- a/arch/ppc/platforms/prpmc750.c +++ b/arch/ppc/platforms/prpmc750.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/console.h> | 22 | #include <linux/console.h> |
| 23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
| 25 | #include <linux/ide.h> | ||
| 26 | #include <linux/root_dev.h> | 25 | #include <linux/root_dev.h> |
| 27 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 28 | #include <linux/serial_reg.h> | 27 | #include <linux/serial_reg.h> |
diff --git a/arch/ppc/platforms/prpmc800.c b/arch/ppc/platforms/prpmc800.c index f4ade5cd7a88..5bcda7f92cd0 100644 --- a/arch/ppc/platforms/prpmc800.c +++ b/arch/ppc/platforms/prpmc800.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include <linux/console.h> | 20 | #include <linux/console.h> |
| 21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
| 22 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
| 23 | #include <linux/ide.h> | ||
| 24 | #include <linux/root_dev.h> | 23 | #include <linux/root_dev.h> |
| 25 | #include <linux/harrier_defs.h> | 24 | #include <linux/harrier_defs.h> |
| 26 | 25 | ||
diff --git a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c index 44d4398a36ff..179b4a99b5b5 100644 --- a/arch/ppc/platforms/radstone_ppc7d.c +++ b/arch/ppc/platforms/radstone_ppc7d.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | #include <linux/initrd.h> | 29 | #include <linux/initrd.h> |
| 30 | #include <linux/console.h> | 30 | #include <linux/console.h> |
| 31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
| 32 | #include <linux/ide.h> | ||
| 33 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
| 34 | #include <linux/root_dev.h> | 33 | #include <linux/root_dev.h> |
| 35 | #include <linux/serial.h> | 34 | #include <linux/serial.h> |
diff --git a/arch/ppc/platforms/residual.c b/arch/ppc/platforms/residual.c index c9911601cfdf..18495e754e30 100644 --- a/arch/ppc/platforms/residual.c +++ b/arch/ppc/platforms/residual.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
| 39 | #include <linux/ioport.h> | 39 | #include <linux/ioport.h> |
| 40 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
| 41 | #include <linux/ide.h> | ||
| 42 | 41 | ||
| 43 | #include <asm/sections.h> | 42 | #include <asm/sections.h> |
| 44 | #include <asm/mmu.h> | 43 | #include <asm/mmu.h> |
diff --git a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c index 3352fae1c722..b4897bdb742a 100644 --- a/arch/ppc/platforms/sandpoint.c +++ b/arch/ppc/platforms/sandpoint.c | |||
| @@ -71,7 +71,6 @@ | |||
| 71 | #include <linux/initrd.h> | 71 | #include <linux/initrd.h> |
| 72 | #include <linux/console.h> | 72 | #include <linux/console.h> |
| 73 | #include <linux/delay.h> | 73 | #include <linux/delay.h> |
| 74 | #include <linux/ide.h> | ||
| 75 | #include <linux/seq_file.h> | 74 | #include <linux/seq_file.h> |
| 76 | #include <linux/root_dev.h> | 75 | #include <linux/root_dev.h> |
| 77 | #include <linux/serial.h> | 76 | #include <linux/serial.h> |
| @@ -559,93 +558,6 @@ sandpoint_show_cpuinfo(struct seq_file *m) | |||
| 559 | return 0; | 558 | return 0; |
| 560 | } | 559 | } |
| 561 | 560 | ||
| 562 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 563 | /* | ||
| 564 | * IDE support. | ||
| 565 | */ | ||
| 566 | static int sandpoint_ide_ports_known = 0; | ||
| 567 | static unsigned long sandpoint_ide_regbase[MAX_HWIFS]; | ||
| 568 | static unsigned long sandpoint_ide_ctl_regbase[MAX_HWIFS]; | ||
| 569 | static unsigned long sandpoint_idedma_regbase; | ||
| 570 | |||
| 571 | static void | ||
| 572 | sandpoint_ide_probe(void) | ||
| 573 | { | ||
| 574 | struct pci_dev *pdev = pci_get_device(PCI_VENDOR_ID_WINBOND, | ||
| 575 | PCI_DEVICE_ID_WINBOND_82C105, NULL); | ||
| 576 | |||
| 577 | if (pdev) { | ||
| 578 | sandpoint_ide_regbase[0]=pdev->resource[0].start; | ||
| 579 | sandpoint_ide_regbase[1]=pdev->resource[2].start; | ||
| 580 | sandpoint_ide_ctl_regbase[0]=pdev->resource[1].start; | ||
| 581 | sandpoint_ide_ctl_regbase[1]=pdev->resource[3].start; | ||
| 582 | sandpoint_idedma_regbase=pdev->resource[4].start; | ||
| 583 | pci_dev_put(pdev); | ||
| 584 | } | ||
| 585 | |||
| 586 | sandpoint_ide_ports_known = 1; | ||
| 587 | } | ||
| 588 | |||
| 589 | static int | ||
| 590 | sandpoint_ide_default_irq(unsigned long base) | ||
| 591 | { | ||
| 592 | if (sandpoint_ide_ports_known == 0) | ||
| 593 | sandpoint_ide_probe(); | ||
| 594 | |||
| 595 | if (base == sandpoint_ide_regbase[0]) | ||
| 596 | return SANDPOINT_IDE_INT0; | ||
| 597 | else if (base == sandpoint_ide_regbase[1]) | ||
| 598 | return SANDPOINT_IDE_INT1; | ||
| 599 | else | ||
| 600 | return 0; | ||
| 601 | } | ||
| 602 | |||
| 603 | static unsigned long | ||
| 604 | sandpoint_ide_default_io_base(int index) | ||
| 605 | { | ||
| 606 | if (sandpoint_ide_ports_known == 0) | ||
| 607 | sandpoint_ide_probe(); | ||
| 608 | |||
| 609 | return sandpoint_ide_regbase[index]; | ||
| 610 | } | ||
| 611 | |||
| 612 | static void __init | ||
| 613 | sandpoint_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, | ||
| 614 | unsigned long ctrl_port, int *irq) | ||
| 615 | { | ||
| 616 | unsigned long reg = data_port; | ||
| 617 | uint alt_status_base; | ||
| 618 | int i; | ||
| 619 | |||
| 620 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { | ||
| 621 | hw->io_ports[i] = reg++; | ||
| 622 | } | ||
| 623 | |||
| 624 | if (data_port == sandpoint_ide_regbase[0]) { | ||
| 625 | alt_status_base = sandpoint_ide_ctl_regbase[0] + 2; | ||
| 626 | hw->irq = 14; | ||
| 627 | } | ||
| 628 | else if (data_port == sandpoint_ide_regbase[1]) { | ||
| 629 | alt_status_base = sandpoint_ide_ctl_regbase[1] + 2; | ||
| 630 | hw->irq = 15; | ||
| 631 | } | ||
| 632 | else { | ||
| 633 | alt_status_base = 0; | ||
| 634 | hw->irq = 0; | ||
| 635 | } | ||
| 636 | |||
| 637 | if (ctrl_port) { | ||
| 638 | hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; | ||
| 639 | } else { | ||
| 640 | hw->io_ports[IDE_CONTROL_OFFSET] = alt_status_base; | ||
| 641 | } | ||
| 642 | |||
| 643 | if (irq != NULL) { | ||
| 644 | *irq = hw->irq; | ||
| 645 | } | ||
| 646 | } | ||
| 647 | #endif | ||
| 648 | |||
| 649 | /* | 561 | /* |
| 650 | * Set BAT 3 to map 0xf8000000 to end of physical memory space 1-to-1. | 562 | * Set BAT 3 to map 0xf8000000 to end of physical memory space 1-to-1. |
| 651 | */ | 563 | */ |
| @@ -736,10 +648,4 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
| 736 | #ifdef CONFIG_SERIAL_TEXT_DEBUG | 648 | #ifdef CONFIG_SERIAL_TEXT_DEBUG |
| 737 | ppc_md.progress = gen550_progress; | 649 | ppc_md.progress = gen550_progress; |
| 738 | #endif | 650 | #endif |
| 739 | |||
| 740 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | ||
| 741 | ppc_ide_md.default_irq = sandpoint_ide_default_irq; | ||
| 742 | ppc_ide_md.default_io_base = sandpoint_ide_default_io_base; | ||
| 743 | ppc_ide_md.ide_init_hwif = sandpoint_ide_init_hwif_ports; | ||
| 744 | #endif | ||
| 745 | } | 651 | } |
diff --git a/arch/ppc/platforms/sandpoint.h b/arch/ppc/platforms/sandpoint.h index 3b64e6418489..ed83759e4044 100644 --- a/arch/ppc/platforms/sandpoint.h +++ b/arch/ppc/platforms/sandpoint.h | |||
| @@ -28,9 +28,6 @@ | |||
| 28 | */ | 28 | */ |
| 29 | #define SANDPOINT_IDE_INT0 23 /* EPIC 7 */ | 29 | #define SANDPOINT_IDE_INT0 23 /* EPIC 7 */ |
| 30 | #define SANDPOINT_IDE_INT1 24 /* EPIC 8 */ | 30 | #define SANDPOINT_IDE_INT1 24 /* EPIC 8 */ |
| 31 | #else | ||
| 32 | #define SANDPOINT_IDE_INT0 14 /* 8259 Test */ | ||
| 33 | #define SANDPOINT_IDE_INT1 15 /* 8259 Test */ | ||
| 34 | #endif | 31 | #endif |
| 35 | 32 | ||
| 36 | /* | 33 | /* |
diff --git a/arch/ppc/platforms/spruce.c b/arch/ppc/platforms/spruce.c index f4de50ba292e..a344134f14b8 100644 --- a/arch/ppc/platforms/spruce.c +++ b/arch/ppc/platforms/spruce.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/console.h> | 22 | #include <linux/console.h> |
| 23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
| 25 | #include <linux/ide.h> | ||
| 26 | #include <linux/root_dev.h> | 25 | #include <linux/root_dev.h> |
| 27 | #include <linux/serial.h> | 26 | #include <linux/serial.h> |
| 28 | #include <linux/tty.h> | 27 | #include <linux/tty.h> |
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c index 9caf850c9b38..19749e9bcf91 100644 --- a/arch/ppc/syslib/m8xx_setup.c +++ b/arch/ppc/syslib/m8xx_setup.c | |||
| @@ -87,8 +87,6 @@ void m8xx_calibrate_decr(void); | |||
| 87 | 87 | ||
| 88 | unsigned char __res[sizeof(bd_t)]; | 88 | unsigned char __res[sizeof(bd_t)]; |
| 89 | 89 | ||
| 90 | extern void m8xx_ide_init(void); | ||
| 91 | |||
| 92 | extern unsigned long find_available_memory(void); | 90 | extern unsigned long find_available_memory(void); |
| 93 | extern void m8xx_cpm_reset(void); | 91 | extern void m8xx_cpm_reset(void); |
| 94 | extern void m8xx_wdt_handler_install(bd_t *bp); | 92 | extern void m8xx_wdt_handler_install(bd_t *bp); |
| @@ -474,8 +472,4 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
| 474 | 472 | ||
| 475 | ppc_md.find_end_of_memory = m8xx_find_end_of_memory; | 473 | ppc_md.find_end_of_memory = m8xx_find_end_of_memory; |
| 476 | ppc_md.setup_io_mappings = m8xx_map_io; | 474 | ppc_md.setup_io_mappings = m8xx_map_io; |
| 477 | |||
| 478 | #if defined(CONFIG_BLK_DEV_MPC8xx_IDE) | ||
| 479 | m8xx_ide_init(); | ||
| 480 | #endif | ||
| 481 | } | 475 | } |
diff --git a/arch/ppc/syslib/ppc4xx_setup.c b/arch/ppc/syslib/ppc4xx_setup.c index debe14c083a1..353d746b47e1 100644 --- a/arch/ppc/syslib/ppc4xx_setup.c +++ b/arch/ppc/syslib/ppc4xx_setup.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
| 25 | #include <linux/rtc.h> | 25 | #include <linux/rtc.h> |
| 26 | #include <linux/console.h> | 26 | #include <linux/console.h> |
| 27 | #include <linux/ide.h> | ||
| 28 | #include <linux/serial_reg.h> | 27 | #include <linux/serial_reg.h> |
| 29 | #include <linux/seq_file.h> | 28 | #include <linux/seq_file.h> |
| 30 | 29 | ||
| @@ -189,24 +188,6 @@ ppc4xx_calibrate_decr(void) | |||
| 189 | mtspr(SPRN_PIT, tb_ticks_per_jiffy); | 188 | mtspr(SPRN_PIT, tb_ticks_per_jiffy); |
| 190 | } | 189 | } |
| 191 | 190 | ||
| 192 | /* | ||
| 193 | * IDE stuff. | ||
| 194 | * should be generic for every IDE PCI chipset | ||
| 195 | */ | ||
| 196 | #if defined(CONFIG_PCI) && defined(CONFIG_IDE) | ||
| 197 | static void | ||
| 198 | ppc4xx_ide_init_hwif_ports(hw_regs_t * hw, unsigned long data_port, | ||
| 199 | unsigned long ctrl_port, int *irq) | ||
| 200 | { | ||
| 201 | int i; | ||
| 202 | |||
| 203 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i) | ||
| 204 | hw->io_ports[i] = data_port + i - IDE_DATA_OFFSET; | ||
| 205 | |||
| 206 | hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; | ||
| 207 | } | ||
| 208 | #endif /* defined(CONFIG_PCI) && defined(CONFIG_IDE) */ | ||
| 209 | |||
| 210 | TODC_ALLOC(); | 191 | TODC_ALLOC(); |
| 211 | 192 | ||
| 212 | /* | 193 | /* |
| @@ -271,10 +252,6 @@ ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
| 271 | #ifdef CONFIG_SERIAL_TEXT_DEBUG | 252 | #ifdef CONFIG_SERIAL_TEXT_DEBUG |
| 272 | ppc_md.progress = gen550_progress; | 253 | ppc_md.progress = gen550_progress; |
| 273 | #endif | 254 | #endif |
| 274 | |||
| 275 | #if defined(CONFIG_PCI) && defined(CONFIG_IDE) | ||
| 276 | ppc_ide_md.ide_init_hwif = ppc4xx_ide_init_hwif_ports; | ||
| 277 | #endif /* defined(CONFIG_PCI) && defined(CONFIG_IDE) */ | ||
| 278 | } | 255 | } |
| 279 | 256 | ||
| 280 | /* Called from machine_check_exception */ | 257 | /* Called from machine_check_exception */ |
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index b73373216b0e..c70d0b6f666f 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c | |||
| @@ -624,7 +624,6 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file, | |||
| 624 | case HDIO_GET_IDENTITY: | 624 | case HDIO_GET_IDENTITY: |
| 625 | case HDIO_DRIVE_TASK: | 625 | case HDIO_DRIVE_TASK: |
| 626 | case HDIO_DRIVE_CMD: | 626 | case HDIO_DRIVE_CMD: |
| 627 | case HDIO_SCAN_HWIF: | ||
| 628 | /* 0x330 is reserved -- it used to be HDIO_GETGEO_BIG */ | 627 | /* 0x330 is reserved -- it used to be HDIO_GETGEO_BIG */ |
| 629 | case 0x330: | 628 | case 0x330: |
| 630 | /* 0x02 -- Floppy ioctls */ | 629 | /* 0x02 -- Floppy ioctls */ |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index eed6d8e1b5c7..87532034d105 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
| @@ -122,24 +122,6 @@ config BLK_DEV_IDE_SATA | |||
| 122 | 122 | ||
| 123 | If unsure, say N. | 123 | If unsure, say N. |
| 124 | 124 | ||
| 125 | config BLK_DEV_HD_IDE | ||
| 126 | bool "Use old disk-only driver on primary interface" | ||
| 127 | depends on (X86 || SH_MPC1211) | ||
| 128 | ---help--- | ||
| 129 | There are two drivers for MFM/RLL/IDE disks. Most people use just | ||
| 130 | the new enhanced driver by itself. This option however installs the | ||
| 131 | old hard disk driver to control the primary IDE/disk interface in | ||
| 132 | the system, leaving the new enhanced IDE driver to take care of only | ||
| 133 | the 2nd/3rd/4th IDE interfaces. Doing this will prevent you from | ||
| 134 | having an IDE/ATAPI CD-ROM or tape drive connected to the primary | ||
| 135 | IDE interface. Choosing this option may be useful for older systems | ||
| 136 | which have MFM/RLL/ESDI controller+drives at the primary port | ||
| 137 | address (0x1f0), along with IDE drives at the secondary/3rd/4th port | ||
| 138 | addresses. | ||
| 139 | |||
| 140 | Normally, just say N here; you will then use the new driver for all | ||
| 141 | 4 interfaces. | ||
| 142 | |||
| 143 | config BLK_DEV_IDEDISK | 125 | config BLK_DEV_IDEDISK |
| 144 | tristate "Include IDE/ATA-2 DISK support" | 126 | tristate "Include IDE/ATA-2 DISK support" |
| 145 | ---help--- | 127 | ---help--- |
| @@ -325,6 +307,7 @@ comment "IDE chipset support/bugfixes" | |||
| 325 | 307 | ||
| 326 | config IDE_GENERIC | 308 | config IDE_GENERIC |
| 327 | tristate "generic/default IDE chipset support" | 309 | tristate "generic/default IDE chipset support" |
| 310 | depends on ALPHA || X86 || IA64 || M32R || MIPS || PPC32 | ||
| 328 | help | 311 | help |
| 329 | If unsure, say N. | 312 | If unsure, say N. |
| 330 | 313 | ||
| @@ -416,12 +399,6 @@ config BLK_DEV_OFFBOARD | |||
| 416 | This can improve the usability of some boot managers such as lilo | 399 | This can improve the usability of some boot managers such as lilo |
| 417 | when booting from a drive on an off-board controller. | 400 | when booting from a drive on an off-board controller. |
| 418 | 401 | ||
| 419 | If you say Y here, and you actually want to reverse the device scan | ||
| 420 | order as explained above, you also need to issue the kernel command | ||
| 421 | line option "ide=reverse". (Try "man bootparam" or see the | ||
| 422 | documentation of your boot loader (lilo or loadlin) about how to | ||
| 423 | pass options to the kernel at boot time.) | ||
| 424 | |||
| 425 | Note that, if you do this, the order of the hd* devices will be | 402 | Note that, if you do this, the order of the hd* devices will be |
| 426 | rearranged which may require modification of fstab and other files. | 403 | rearranged which may require modification of fstab and other files. |
| 427 | 404 | ||
| @@ -615,8 +592,7 @@ config BLK_DEV_HPT366 | |||
| 615 | reference to device 0x80. The other solution is to say Y to "Boot | 592 | reference to device 0x80. The other solution is to say Y to "Boot |
| 616 | off-board chipsets first support" (CONFIG_BLK_DEV_OFFBOARD) unless | 593 | off-board chipsets first support" (CONFIG_BLK_DEV_OFFBOARD) unless |
| 617 | your mother board has the chipset natively mounted. Regardless one | 594 | your mother board has the chipset natively mounted. Regardless one |
| 618 | should use the fore mentioned option and call at LILO or include | 595 | should use the fore mentioned option and call at LILO. |
| 619 | "ide=reverse" in LILO's append-line. | ||
| 620 | 596 | ||
| 621 | This driver requires dynamic tuning of the chipset during the | 597 | This driver requires dynamic tuning of the chipset during the |
| 622 | ide-probe at boot. It is reported to support DVD II drives, by the | 598 | ide-probe at boot. It is reported to support DVD II drives, by the |
| @@ -1049,7 +1025,7 @@ config IDE_EXT_DIRECT | |||
| 1049 | endchoice | 1025 | endchoice |
| 1050 | 1026 | ||
| 1051 | # no isa -> no vlb | 1027 | # no isa -> no vlb |
| 1052 | if ISA | 1028 | if ISA && (ALPHA || X86 || MIPS) |
| 1053 | 1029 | ||
| 1054 | comment "Other IDE chipsets support" | 1030 | comment "Other IDE chipsets support" |
| 1055 | comment "Note: most of these also require special kernel boot parameters" | 1031 | comment "Note: most of these also require special kernel boot parameters" |
| @@ -1060,8 +1036,8 @@ config BLK_DEV_4DRIVES | |||
| 1060 | Certain older chipsets, including the Tekram 690CD, use a single set | 1036 | Certain older chipsets, including the Tekram 690CD, use a single set |
| 1061 | of I/O ports at 0x1f0 to control up to four drives, instead of the | 1037 | of I/O ports at 0x1f0 to control up to four drives, instead of the |
| 1062 | customary two drives per port. Support for this can be enabled at | 1038 | customary two drives per port. Support for this can be enabled at |
| 1063 | runtime using the "ide0=four" kernel boot parameter if you say Y | 1039 | runtime using the "ide-4drives.probe" kernel boot parameter if you |
| 1064 | here. | 1040 | say Y here. |
| 1065 | 1041 | ||
| 1066 | config BLK_DEV_ALI14XX | 1042 | config BLK_DEV_ALI14XX |
| 1067 | tristate "ALI M14xx support" | 1043 | tristate "ALI M14xx support" |
| @@ -1114,14 +1090,10 @@ config BLK_DEV_IDEDMA | |||
| 1114 | def_bool BLK_DEV_IDEDMA_SFF || BLK_DEV_IDEDMA_PMAC || \ | 1090 | def_bool BLK_DEV_IDEDMA_SFF || BLK_DEV_IDEDMA_PMAC || \ |
| 1115 | BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 1091 | BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
| 1116 | 1092 | ||
| 1117 | config IDE_ARCH_OBSOLETE_INIT | ||
| 1118 | def_bool ALPHA || (ARM && !ARCH_L7200) || BLACKFIN || X86 || IA64 || M32R || MIPS || PARISC || PPC || (SUPERH64 && BLK_DEV_IDEPCI) || SPARC | ||
| 1119 | |||
| 1120 | endif | 1093 | endif |
| 1121 | 1094 | ||
| 1122 | config BLK_DEV_HD_ONLY | 1095 | config BLK_DEV_HD_ONLY |
| 1123 | bool "Old hard disk (MFM/RLL/IDE) driver" | 1096 | bool "Old hard disk (MFM/RLL/IDE) driver" |
| 1124 | depends on BLK_DEV_IDE=n | ||
| 1125 | help | 1097 | help |
| 1126 | There are two drivers for MFM/RLL/IDE hard disks. Most people use | 1098 | There are two drivers for MFM/RLL/IDE hard disks. Most people use |
| 1127 | the newer enhanced driver, but this old one is still around for two | 1099 | the newer enhanced driver, but this old one is still around for two |
| @@ -1133,12 +1105,16 @@ config BLK_DEV_HD_ONLY | |||
| 1133 | for systems with only older MFM/RLL/ESDI drives. Choosing the old | 1105 | for systems with only older MFM/RLL/ESDI drives. Choosing the old |
| 1134 | driver can save 13 KB or so of kernel memory. | 1106 | driver can save 13 KB or so of kernel memory. |
| 1135 | 1107 | ||
| 1108 | If you want to use this driver together with the new one you have | ||
| 1109 | to use "hda=noprobe hdb=noprobe" kernel parameters to prevent the new | ||
| 1110 | driver from probing the primary interface. | ||
| 1111 | |||
| 1136 | If you are unsure, then just choose the Enhanced IDE/MFM/RLL driver | 1112 | If you are unsure, then just choose the Enhanced IDE/MFM/RLL driver |
| 1137 | instead of this one. For more detailed information, read the | 1113 | instead of this one. For more detailed information, read the |
| 1138 | Disk-HOWTO, available from | 1114 | Disk-HOWTO, available from |
| 1139 | <http://www.tldp.org/docs.html#howto>. | 1115 | <http://www.tldp.org/docs.html#howto>. |
| 1140 | 1116 | ||
| 1141 | config BLK_DEV_HD | 1117 | config BLK_DEV_HD |
| 1142 | def_bool BLK_DEV_HD_IDE || BLK_DEV_HD_ONLY | 1118 | def_bool BLK_DEV_HD_ONLY |
| 1143 | 1119 | ||
| 1144 | endif # IDE | 1120 | endif # IDE |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index a4a4323be911..571544c37bb2 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
| @@ -36,9 +36,9 @@ ifeq ($(CONFIG_BLK_DEV_CMD640), y) | |||
| 36 | endif | 36 | endif |
| 37 | 37 | ||
| 38 | obj-$(CONFIG_BLK_DEV_IDE) += cris/ ppc/ | 38 | obj-$(CONFIG_BLK_DEV_IDE) += cris/ ppc/ |
| 39 | obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o | ||
| 40 | obj-$(CONFIG_IDE_H8300) += h8300/ | 39 | obj-$(CONFIG_IDE_H8300) += h8300/ |
| 41 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o | 40 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o |
| 41 | obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o | ||
| 42 | 42 | ||
| 43 | ide-cd_mod-y += ide-cd.o ide-cd_ioctl.o ide-cd_verbose.o | 43 | ide-cd_mod-y += ide-cd.o ide-cd_ioctl.o ide-cd_verbose.o |
| 44 | 44 | ||
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c index 161d30c8481e..ec46c44b061c 100644 --- a/drivers/ide/arm/bast-ide.c +++ b/drivers/ide/arm/bast-ide.c | |||
| @@ -41,15 +41,15 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq) | |||
| 41 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); | 41 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); |
| 42 | hw.irq = irq; | 42 | hw.irq = irq; |
| 43 | 43 | ||
| 44 | hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]); | 44 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
| 45 | if (hwif == NULL) | 45 | if (hwif == NULL) |
| 46 | goto out; | 46 | goto out; |
| 47 | 47 | ||
| 48 | i = hwif->index; | 48 | i = hwif->index; |
| 49 | 49 | ||
| 50 | if (hwif->present) | 50 | if (hwif->present) |
| 51 | ide_unregister(i, 0, 0); | 51 | ide_unregister(i); |
| 52 | else if (!hwif->hold) | 52 | else |
| 53 | ide_init_port_data(hwif, i); | 53 | ide_init_port_data(hwif, i); |
| 54 | 54 | ||
| 55 | ide_init_port_hw(hwif, &hw); | 55 | ide_init_port_hw(hwif, &hw); |
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c index 8e1f6bd33887..474162cdf665 100644 --- a/drivers/ide/arm/palm_bk3710.c +++ b/drivers/ide/arm/palm_bk3710.c | |||
| @@ -378,15 +378,15 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev) | |||
| 378 | hw.irq = irq->start; | 378 | hw.irq = irq->start; |
| 379 | hw.chipset = ide_palm3710; | 379 | hw.chipset = ide_palm3710; |
| 380 | 380 | ||
| 381 | hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]); | 381 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
| 382 | if (hwif == NULL) | 382 | if (hwif == NULL) |
| 383 | goto out; | 383 | goto out; |
| 384 | 384 | ||
| 385 | i = hwif->index; | 385 | i = hwif->index; |
| 386 | 386 | ||
| 387 | if (hwif->present) | 387 | if (hwif->present) |
| 388 | ide_unregister(i, 0, 0); | 388 | ide_unregister(i); |
| 389 | else if (!hwif->hold) | 389 | else |
| 390 | ide_init_port_data(hwif, i); | 390 | ide_init_port_data(hwif, i); |
| 391 | 391 | ||
| 392 | ide_init_port_hw(hwif, &hw); | 392 | ide_init_port_hw(hwif, &hw); |
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index efba00d2fc37..b30adcf321c3 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c | |||
| @@ -76,7 +76,7 @@ static void __devexit rapide_remove(struct expansion_card *ec) | |||
| 76 | 76 | ||
| 77 | ecard_set_drvdata(ec, NULL); | 77 | ecard_set_drvdata(ec, NULL); |
| 78 | 78 | ||
| 79 | ide_unregister(hwif->index, 0, 0); | 79 | ide_unregister(hwif->index); |
| 80 | 80 | ||
| 81 | ecard_release_resources(ec); | 81 | ecard_release_resources(ec); |
| 82 | } | 82 | } |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index c8ffbaf29a88..31266d278095 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
| @@ -228,7 +228,10 @@ cris_ide_fill_descriptor(cris_dma_descr_type *d, void* buf, unsigned int len, in | |||
| 228 | static void | 228 | static void |
| 229 | cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int dir,int type,int len) | 229 | cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int dir,int type,int len) |
| 230 | { | 230 | { |
| 231 | reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, IDE_DATA_REG); | 231 | ide_hwif_t *hwif = drive->hwif; |
| 232 | |||
| 233 | reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, | ||
| 234 | hwif->io_ports[IDE_DATA_OFFSET]); | ||
| 232 | reg_ata_rw_trf_cnt trf_cnt = {0}; | 235 | reg_ata_rw_trf_cnt trf_cnt = {0}; |
| 233 | 236 | ||
| 234 | mycontext.saved_data = (dma_descr_data*)virt_to_phys(d); | 237 | mycontext.saved_data = (dma_descr_data*)virt_to_phys(d); |
| @@ -264,8 +267,12 @@ cris_ide_wait_dma(int dir) | |||
| 264 | 267 | ||
| 265 | static int cris_dma_test_irq(ide_drive_t *drive) | 268 | static int cris_dma_test_irq(ide_drive_t *drive) |
| 266 | { | 269 | { |
| 270 | ide_hwif_t *hwif = drive->hwif; | ||
| 267 | int intr = REG_RD_INT(ata, regi_ata, r_intr); | 271 | int intr = REG_RD_INT(ata, regi_ata, r_intr); |
| 268 | reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, IDE_DATA_REG); | 272 | |
| 273 | reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, | ||
| 274 | hwif->io_ports[IDE_DATA_OFFSET]); | ||
| 275 | |||
| 269 | return intr & (1 << ctrl2.sel) ? 1 : 0; | 276 | return intr & (1 << ctrl2.sel) ? 1 : 0; |
| 270 | } | 277 | } |
| 271 | 278 | ||
| @@ -523,7 +530,8 @@ static void cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int d | |||
| 523 | IO_STATE(R_ATA_CTRL_DATA, handsh, dma); | 530 | IO_STATE(R_ATA_CTRL_DATA, handsh, dma); |
| 524 | *R_ATA_CTRL_DATA = | 531 | *R_ATA_CTRL_DATA = |
| 525 | cmd | | 532 | cmd | |
| 526 | IO_FIELD(R_ATA_CTRL_DATA, data, IDE_DATA_REG) | | 533 | IO_FIELD(R_ATA_CTRL_DATA, data, |
| 534 | drive->hwif->io_ports[IDE_DATA_OFFSET]) | | ||
| 527 | IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) | | 535 | IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) | |
| 528 | IO_STATE(R_ATA_CTRL_DATA, multi, on) | | 536 | IO_STATE(R_ATA_CTRL_DATA, multi, on) | |
| 529 | IO_STATE(R_ATA_CTRL_DATA, dma_size, word); | 537 | IO_STATE(R_ATA_CTRL_DATA, dma_size, word); |
| @@ -541,7 +549,9 @@ cris_ide_wait_dma(int dir) | |||
| 541 | static int cris_dma_test_irq(ide_drive_t *drive) | 549 | static int cris_dma_test_irq(ide_drive_t *drive) |
| 542 | { | 550 | { |
| 543 | int intr = *R_IRQ_MASK0_RD; | 551 | int intr = *R_IRQ_MASK0_RD; |
| 544 | int bus = IO_EXTRACT(R_ATA_CTRL_DATA, sel, IDE_DATA_REG); | 552 | int bus = IO_EXTRACT(R_ATA_CTRL_DATA, sel, |
| 553 | drive->hwif->io_ports[IDE_DATA_OFFSET]); | ||
| 554 | |||
| 545 | return intr & (1 << (bus + IO_BITNR(R_IRQ_MASK0_RD, ata_irq0))) ? 1 : 0; | 555 | return intr & (1 << (bus + IO_BITNR(R_IRQ_MASK0_RD, ata_irq0))) ? 1 : 0; |
| 546 | } | 556 | } |
| 547 | 557 | ||
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index e07b189f3ec8..0f6fb6b72dd9 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
| @@ -710,6 +710,8 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif) | |||
| 710 | for (i = 0; i < MAX_DRIVES; i++) { | 710 | for (i = 0; i < MAX_DRIVES; i++) { |
| 711 | drive = &hwif->drives[i]; | 711 | drive = &hwif->drives[i]; |
| 712 | 712 | ||
| 713 | memset(drive->acpidata, 0, sizeof(*drive->acpidata)); | ||
| 714 | |||
| 713 | if (!drive->present) | 715 | if (!drive->present) |
| 714 | continue; | 716 | continue; |
| 715 | 717 | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index c8d0e8715997..396000208f81 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
| @@ -542,7 +542,8 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, | |||
| 542 | 542 | ||
| 543 | /* packet command */ | 543 | /* packet command */ |
| 544 | spin_lock_irqsave(&ide_lock, flags); | 544 | spin_lock_irqsave(&ide_lock, flags); |
| 545 | hwif->OUTBSYNC(drive, WIN_PACKETCMD, IDE_COMMAND_REG); | 545 | hwif->OUTBSYNC(drive, WIN_PACKETCMD, |
| 546 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 546 | ndelay(400); | 547 | ndelay(400); |
| 547 | spin_unlock_irqrestore(&ide_lock, flags); | 548 | spin_unlock_irqrestore(&ide_lock, flags); |
| 548 | 549 | ||
| @@ -992,6 +993,7 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq) | |||
| 992 | 993 | ||
| 993 | static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | 994 | static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) |
| 994 | { | 995 | { |
| 996 | ide_hwif_t *hwif = drive->hwif; | ||
| 995 | struct cdrom_info *info = drive->driver_data; | 997 | struct cdrom_info *info = drive->driver_data; |
| 996 | struct request *rq = HWGROUP(drive)->rq; | 998 | struct request *rq = HWGROUP(drive)->rq; |
| 997 | xfer_func_t *xferfunc; | 999 | xfer_func_t *xferfunc; |
| @@ -1032,9 +1034,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
| 1032 | /* | 1034 | /* |
| 1033 | * ok we fall to pio :/ | 1035 | * ok we fall to pio :/ |
| 1034 | */ | 1036 | */ |
| 1035 | ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3; | 1037 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]) & 0x3; |
| 1036 | lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); | 1038 | lowcyl = hwif->INB(hwif->io_ports[IDE_BCOUNTL_OFFSET]); |
| 1037 | highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); | 1039 | highcyl = hwif->INB(hwif->io_ports[IDE_BCOUNTH_OFFSET]); |
| 1038 | 1040 | ||
| 1039 | len = lowcyl + (256 * highcyl); | 1041 | len = lowcyl + (256 * highcyl); |
| 1040 | 1042 | ||
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index faf22d716f80..5f133dfb541c 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
| @@ -78,40 +78,6 @@ | |||
| 78 | */ | 78 | */ |
| 79 | #define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES) | 79 | #define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES) |
| 80 | 80 | ||
| 81 | typedef struct idefloppy_packet_command_s { | ||
| 82 | u8 c[12]; /* Actual packet bytes */ | ||
| 83 | int retries; /* On each retry, we increment | ||
| 84 | retries */ | ||
| 85 | int error; /* Error code */ | ||
| 86 | int request_transfer; /* Bytes to transfer */ | ||
| 87 | int actually_transferred; /* Bytes actually transferred */ | ||
| 88 | int buffer_size; /* Size of our data buffer */ | ||
| 89 | int b_count; /* Missing/Available data on | ||
| 90 | the current buffer */ | ||
| 91 | struct request *rq; /* The corresponding request */ | ||
| 92 | u8 *buffer; /* Data buffer */ | ||
| 93 | u8 *current_position; /* Pointer into above buffer */ | ||
| 94 | void (*callback) (ide_drive_t *); /* Called when this packet | ||
| 95 | command is completed */ | ||
| 96 | u8 pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */ | ||
| 97 | unsigned long flags; /* Status/Action bit flags: long | ||
| 98 | for set_bit */ | ||
| 99 | } idefloppy_pc_t; | ||
| 100 | |||
| 101 | /* Packet command flag bits. */ | ||
| 102 | enum { | ||
| 103 | /* 1 when we prefer to use DMA if possible */ | ||
| 104 | PC_FLAG_DMA_RECOMMENDED = (1 << 0), | ||
| 105 | /* 1 while DMA in progress */ | ||
| 106 | PC_FLAG_DMA_IN_PROGRESS = (1 << 1), | ||
| 107 | /* 1 when encountered problem during DMA */ | ||
| 108 | PC_FLAG_DMA_ERROR = (1 << 2), | ||
| 109 | /* Data direction */ | ||
| 110 | PC_FLAG_WRITING = (1 << 3), | ||
| 111 | /* Suppress error reporting */ | ||
| 112 | PC_FLAG_SUPPRESS_ERROR = (1 << 4), | ||
| 113 | }; | ||
| 114 | |||
| 115 | /* format capacities descriptor codes */ | 81 | /* format capacities descriptor codes */ |
| 116 | #define CAPACITY_INVALID 0x00 | 82 | #define CAPACITY_INVALID 0x00 |
| 117 | #define CAPACITY_UNFORMATTED 0x01 | 83 | #define CAPACITY_UNFORMATTED 0x01 |
| @@ -131,11 +97,11 @@ typedef struct ide_floppy_obj { | |||
| 131 | unsigned int openers; /* protected by BKL for now */ | 97 | unsigned int openers; /* protected by BKL for now */ |
| 132 | 98 | ||
| 133 | /* Current packet command */ | 99 | /* Current packet command */ |
| 134 | idefloppy_pc_t *pc; | 100 | struct ide_atapi_pc *pc; |
| 135 | /* Last failed packet command */ | 101 | /* Last failed packet command */ |
| 136 | idefloppy_pc_t *failed_pc; | 102 | struct ide_atapi_pc *failed_pc; |
| 137 | /* Packet command stack */ | 103 | /* Packet command stack */ |
| 138 | idefloppy_pc_t pc_stack[IDEFLOPPY_PC_STACK]; | 104 | struct ide_atapi_pc pc_stack[IDEFLOPPY_PC_STACK]; |
| 139 | /* Next free packet command storage space */ | 105 | /* Next free packet command storage space */ |
| 140 | int pc_stack_index; | 106 | int pc_stack_index; |
| 141 | struct request rq_stack[IDEFLOPPY_PC_STACK]; | 107 | struct request rq_stack[IDEFLOPPY_PC_STACK]; |
| @@ -195,32 +161,6 @@ enum { | |||
| 195 | #define IDEFLOPPY_ERROR_GENERAL 101 | 161 | #define IDEFLOPPY_ERROR_GENERAL 101 |
| 196 | 162 | ||
| 197 | /* | 163 | /* |
| 198 | * The following is used to format the general configuration word of the | ||
| 199 | * ATAPI IDENTIFY DEVICE command. | ||
| 200 | */ | ||
| 201 | struct idefloppy_id_gcw { | ||
| 202 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 203 | unsigned packet_size :2; /* Packet Size */ | ||
| 204 | unsigned reserved234 :3; /* Reserved */ | ||
| 205 | unsigned drq_type :2; /* Command packet DRQ type */ | ||
| 206 | unsigned removable :1; /* Removable media */ | ||
| 207 | unsigned device_type :5; /* Device type */ | ||
| 208 | unsigned reserved13 :1; /* Reserved */ | ||
| 209 | unsigned protocol :2; /* Protocol type */ | ||
| 210 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
| 211 | unsigned protocol :2; /* Protocol type */ | ||
| 212 | unsigned reserved13 :1; /* Reserved */ | ||
| 213 | unsigned device_type :5; /* Device type */ | ||
| 214 | unsigned removable :1; /* Removable media */ | ||
| 215 | unsigned drq_type :2; /* Command packet DRQ type */ | ||
| 216 | unsigned reserved234 :3; /* Reserved */ | ||
| 217 | unsigned packet_size :2; /* Packet Size */ | ||
| 218 | #else | ||
| 219 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
| 220 | #endif | ||
| 221 | }; | ||
| 222 | |||
| 223 | /* | ||
| 224 | * Pages of the SELECT SENSE / MODE SENSE packet commands. | 164 | * Pages of the SELECT SENSE / MODE SENSE packet commands. |
| 225 | * See SFF-8070i spec. | 165 | * See SFF-8070i spec. |
| 226 | */ | 166 | */ |
| @@ -256,27 +196,10 @@ static void ide_floppy_put(struct ide_floppy_obj *floppy) | |||
| 256 | } | 196 | } |
| 257 | 197 | ||
| 258 | /* | 198 | /* |
| 259 | * Too bad. The drive wants to send us data which we are not ready to accept. | ||
| 260 | * Just throw it away. | ||
| 261 | */ | ||
| 262 | static void idefloppy_discard_data(ide_drive_t *drive, unsigned int bcount) | ||
| 263 | { | ||
| 264 | while (bcount--) | ||
| 265 | (void) HWIF(drive)->INB(IDE_DATA_REG); | ||
| 266 | } | ||
| 267 | |||
| 268 | static void idefloppy_write_zeros(ide_drive_t *drive, unsigned int bcount) | ||
| 269 | { | ||
| 270 | while (bcount--) | ||
| 271 | HWIF(drive)->OUTB(0, IDE_DATA_REG); | ||
| 272 | } | ||
| 273 | |||
| 274 | |||
| 275 | /* | ||
| 276 | * Used to finish servicing a request. For read/write requests, we will call | 199 | * Used to finish servicing a request. For read/write requests, we will call |
| 277 | * ide_end_request to pass to the next buffer. | 200 | * ide_end_request to pass to the next buffer. |
| 278 | */ | 201 | */ |
| 279 | static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs) | 202 | static int idefloppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) |
| 280 | { | 203 | { |
| 281 | idefloppy_floppy_t *floppy = drive->driver_data; | 204 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 282 | struct request *rq = HWGROUP(drive)->rq; | 205 | struct request *rq = HWGROUP(drive)->rq; |
| @@ -305,7 +228,7 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs) | |||
| 305 | return 0; | 228 | return 0; |
| 306 | } | 229 | } |
| 307 | 230 | ||
| 308 | static void ide_floppy_io_buffers(ide_drive_t *drive, idefloppy_pc_t *pc, | 231 | static void ide_floppy_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 309 | unsigned int bcount, int direction) | 232 | unsigned int bcount, int direction) |
| 310 | { | 233 | { |
| 311 | struct request *rq = pc->rq; | 234 | struct request *rq = pc->rq; |
| @@ -333,26 +256,26 @@ static void ide_floppy_io_buffers(ide_drive_t *drive, idefloppy_pc_t *pc, | |||
| 333 | done += count; | 256 | done += count; |
| 334 | } | 257 | } |
| 335 | 258 | ||
| 336 | idefloppy_do_end_request(drive, 1, done >> 9); | 259 | idefloppy_end_request(drive, 1, done >> 9); |
| 337 | 260 | ||
| 338 | if (bcount) { | 261 | if (bcount) { |
| 339 | printk(KERN_ERR "%s: leftover data in %s, bcount == %d\n", | 262 | printk(KERN_ERR "%s: leftover data in %s, bcount == %d\n", |
| 340 | drive->name, __func__, bcount); | 263 | drive->name, __func__, bcount); |
| 341 | if (direction) | 264 | if (direction) |
| 342 | idefloppy_write_zeros(drive, bcount); | 265 | ide_atapi_write_zeros(drive, bcount); |
| 343 | else | 266 | else |
| 344 | idefloppy_discard_data(drive, bcount); | 267 | ide_atapi_discard_data(drive, bcount); |
| 345 | |||
| 346 | } | 268 | } |
| 347 | } | 269 | } |
| 348 | 270 | ||
| 349 | static void idefloppy_update_buffers(ide_drive_t *drive, idefloppy_pc_t *pc) | 271 | static void idefloppy_update_buffers(ide_drive_t *drive, |
| 272 | struct ide_atapi_pc *pc) | ||
| 350 | { | 273 | { |
| 351 | struct request *rq = pc->rq; | 274 | struct request *rq = pc->rq; |
| 352 | struct bio *bio = rq->bio; | 275 | struct bio *bio = rq->bio; |
| 353 | 276 | ||
| 354 | while ((bio = rq->bio) != NULL) | 277 | while ((bio = rq->bio) != NULL) |
| 355 | idefloppy_do_end_request(drive, 1, 0); | 278 | idefloppy_end_request(drive, 1, 0); |
| 356 | } | 279 | } |
| 357 | 280 | ||
| 358 | /* | 281 | /* |
| @@ -360,7 +283,7 @@ static void idefloppy_update_buffers(ide_drive_t *drive, idefloppy_pc_t *pc) | |||
| 360 | * the current request so that it will be processed immediately, on the next | 283 | * the current request so that it will be processed immediately, on the next |
| 361 | * pass through the driver. | 284 | * pass through the driver. |
| 362 | */ | 285 | */ |
| 363 | static void idefloppy_queue_pc_head(ide_drive_t *drive, idefloppy_pc_t *pc, | 286 | static void idefloppy_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 364 | struct request *rq) | 287 | struct request *rq) |
| 365 | { | 288 | { |
| 366 | struct ide_floppy_obj *floppy = drive->driver_data; | 289 | struct ide_floppy_obj *floppy = drive->driver_data; |
| @@ -372,7 +295,7 @@ static void idefloppy_queue_pc_head(ide_drive_t *drive, idefloppy_pc_t *pc, | |||
| 372 | (void) ide_do_drive_cmd(drive, rq, ide_preempt); | 295 | (void) ide_do_drive_cmd(drive, rq, ide_preempt); |
| 373 | } | 296 | } |
| 374 | 297 | ||
| 375 | static idefloppy_pc_t *idefloppy_next_pc_storage(ide_drive_t *drive) | 298 | static struct ide_atapi_pc *idefloppy_next_pc_storage(ide_drive_t *drive) |
| 376 | { | 299 | { |
| 377 | idefloppy_floppy_t *floppy = drive->driver_data; | 300 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 378 | 301 | ||
| @@ -393,7 +316,7 @@ static struct request *idefloppy_next_rq_storage(ide_drive_t *drive) | |||
| 393 | static void idefloppy_request_sense_callback(ide_drive_t *drive) | 316 | static void idefloppy_request_sense_callback(ide_drive_t *drive) |
| 394 | { | 317 | { |
| 395 | idefloppy_floppy_t *floppy = drive->driver_data; | 318 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 396 | u8 *buf = floppy->pc->buffer; | 319 | u8 *buf = floppy->pc->buf; |
| 397 | 320 | ||
| 398 | debug_log("Reached %s\n", __func__); | 321 | debug_log("Reached %s\n", __func__); |
| 399 | 322 | ||
| @@ -418,11 +341,11 @@ static void idefloppy_request_sense_callback(ide_drive_t *drive) | |||
| 418 | floppy->ascq); | 341 | floppy->ascq); |
| 419 | 342 | ||
| 420 | 343 | ||
| 421 | idefloppy_do_end_request(drive, 1, 0); | 344 | idefloppy_end_request(drive, 1, 0); |
| 422 | } else { | 345 | } else { |
| 423 | printk(KERN_ERR "Error in REQUEST SENSE itself - Aborting" | 346 | printk(KERN_ERR "Error in REQUEST SENSE itself - Aborting" |
| 424 | " request!\n"); | 347 | " request!\n"); |
| 425 | idefloppy_do_end_request(drive, 0, 0); | 348 | idefloppy_end_request(drive, 0, 0); |
| 426 | } | 349 | } |
| 427 | } | 350 | } |
| 428 | 351 | ||
| @@ -433,27 +356,27 @@ static void idefloppy_pc_callback(ide_drive_t *drive) | |||
| 433 | 356 | ||
| 434 | debug_log("Reached %s\n", __func__); | 357 | debug_log("Reached %s\n", __func__); |
| 435 | 358 | ||
| 436 | idefloppy_do_end_request(drive, floppy->pc->error ? 0 : 1, 0); | 359 | idefloppy_end_request(drive, floppy->pc->error ? 0 : 1, 0); |
| 437 | } | 360 | } |
| 438 | 361 | ||
| 439 | static void idefloppy_init_pc(idefloppy_pc_t *pc) | 362 | static void idefloppy_init_pc(struct ide_atapi_pc *pc) |
| 440 | { | 363 | { |
| 441 | memset(pc->c, 0, 12); | 364 | memset(pc->c, 0, 12); |
| 442 | pc->retries = 0; | 365 | pc->retries = 0; |
| 443 | pc->flags = 0; | 366 | pc->flags = 0; |
| 444 | pc->request_transfer = 0; | 367 | pc->req_xfer = 0; |
| 445 | pc->buffer = pc->pc_buffer; | 368 | pc->buf = pc->pc_buf; |
| 446 | pc->buffer_size = IDEFLOPPY_PC_BUFFER_SIZE; | 369 | pc->buf_size = IDEFLOPPY_PC_BUFFER_SIZE; |
| 447 | pc->callback = &idefloppy_pc_callback; | 370 | pc->idefloppy_callback = &idefloppy_pc_callback; |
| 448 | } | 371 | } |
| 449 | 372 | ||
| 450 | static void idefloppy_create_request_sense_cmd(idefloppy_pc_t *pc) | 373 | static void idefloppy_create_request_sense_cmd(struct ide_atapi_pc *pc) |
| 451 | { | 374 | { |
| 452 | idefloppy_init_pc(pc); | 375 | idefloppy_init_pc(pc); |
| 453 | pc->c[0] = GPCMD_REQUEST_SENSE; | 376 | pc->c[0] = GPCMD_REQUEST_SENSE; |
| 454 | pc->c[4] = 255; | 377 | pc->c[4] = 255; |
| 455 | pc->request_transfer = 18; | 378 | pc->req_xfer = 18; |
| 456 | pc->callback = &idefloppy_request_sense_callback; | 379 | pc->idefloppy_callback = &idefloppy_request_sense_callback; |
| 457 | } | 380 | } |
| 458 | 381 | ||
| 459 | /* | 382 | /* |
| @@ -462,7 +385,7 @@ static void idefloppy_create_request_sense_cmd(idefloppy_pc_t *pc) | |||
| 462 | */ | 385 | */ |
| 463 | static void idefloppy_retry_pc(ide_drive_t *drive) | 386 | static void idefloppy_retry_pc(ide_drive_t *drive) |
| 464 | { | 387 | { |
| 465 | idefloppy_pc_t *pc; | 388 | struct ide_atapi_pc *pc; |
| 466 | struct request *rq; | 389 | struct request *rq; |
| 467 | 390 | ||
| 468 | (void)ide_read_error(drive); | 391 | (void)ide_read_error(drive); |
| @@ -477,7 +400,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
| 477 | { | 400 | { |
| 478 | idefloppy_floppy_t *floppy = drive->driver_data; | 401 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 479 | ide_hwif_t *hwif = drive->hwif; | 402 | ide_hwif_t *hwif = drive->hwif; |
| 480 | idefloppy_pc_t *pc = floppy->pc; | 403 | struct ide_atapi_pc *pc = floppy->pc; |
| 481 | struct request *rq = pc->rq; | 404 | struct request *rq = pc->rq; |
| 482 | xfer_func_t *xferfunc; | 405 | xfer_func_t *xferfunc; |
| 483 | unsigned int temp; | 406 | unsigned int temp; |
| @@ -494,7 +417,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
| 494 | rq_data_dir(rq) ? "write" : "read"); | 417 | rq_data_dir(rq) ? "write" : "read"); |
| 495 | pc->flags |= PC_FLAG_DMA_ERROR; | 418 | pc->flags |= PC_FLAG_DMA_ERROR; |
| 496 | } else { | 419 | } else { |
| 497 | pc->actually_transferred = pc->request_transfer; | 420 | pc->xferred = pc->req_xfer; |
| 498 | idefloppy_update_buffers(drive, pc); | 421 | idefloppy_update_buffers(drive, pc); |
| 499 | } | 422 | } |
| 500 | debug_log("DMA finished\n"); | 423 | debug_log("DMA finished\n"); |
| @@ -506,7 +429,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
| 506 | /* No more interrupts */ | 429 | /* No more interrupts */ |
| 507 | if ((stat & DRQ_STAT) == 0) { | 430 | if ((stat & DRQ_STAT) == 0) { |
| 508 | debug_log("Packet command completed, %d bytes transferred\n", | 431 | debug_log("Packet command completed, %d bytes transferred\n", |
| 509 | pc->actually_transferred); | 432 | pc->xferred); |
| 510 | pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; | 433 | pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; |
| 511 | 434 | ||
| 512 | local_irq_enable_in_hardirq(); | 435 | local_irq_enable_in_hardirq(); |
| @@ -529,7 +452,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
| 529 | if (floppy->failed_pc == pc) | 452 | if (floppy->failed_pc == pc) |
| 530 | floppy->failed_pc = NULL; | 453 | floppy->failed_pc = NULL; |
| 531 | /* Command finished - Call the callback function */ | 454 | /* Command finished - Call the callback function */ |
| 532 | pc->callback(drive); | 455 | pc->idefloppy_callback(drive); |
| 533 | return ide_stopped; | 456 | return ide_stopped; |
| 534 | } | 457 | } |
| 535 | 458 | ||
| @@ -542,10 +465,10 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
| 542 | } | 465 | } |
| 543 | 466 | ||
| 544 | /* Get the number of bytes to transfer */ | 467 | /* Get the number of bytes to transfer */ |
| 545 | bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | | 468 | bcount = (hwif->INB(hwif->io_ports[IDE_BCOUNTH_OFFSET]) << 8) | |
| 546 | hwif->INB(IDE_BCOUNTL_REG); | 469 | hwif->INB(hwif->io_ports[IDE_BCOUNTL_OFFSET]); |
| 547 | /* on this interrupt */ | 470 | /* on this interrupt */ |
| 548 | ireason = hwif->INB(IDE_IREASON_REG); | 471 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); |
| 549 | 472 | ||
| 550 | if (ireason & CD) { | 473 | if (ireason & CD) { |
| 551 | printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __func__); | 474 | printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __func__); |
| @@ -561,13 +484,13 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
| 561 | } | 484 | } |
| 562 | if (!(pc->flags & PC_FLAG_WRITING)) { | 485 | if (!(pc->flags & PC_FLAG_WRITING)) { |
| 563 | /* Reading - Check that we have enough space */ | 486 | /* Reading - Check that we have enough space */ |
| 564 | temp = pc->actually_transferred + bcount; | 487 | temp = pc->xferred + bcount; |
| 565 | if (temp > pc->request_transfer) { | 488 | if (temp > pc->req_xfer) { |
| 566 | if (temp > pc->buffer_size) { | 489 | if (temp > pc->buf_size) { |
| 567 | printk(KERN_ERR "ide-floppy: The floppy wants " | 490 | printk(KERN_ERR "ide-floppy: The floppy wants " |
| 568 | "to send us more data than expected " | 491 | "to send us more data than expected " |
| 569 | "- discarding data\n"); | 492 | "- discarding data\n"); |
| 570 | idefloppy_discard_data(drive, bcount); | 493 | ide_atapi_discard_data(drive, bcount); |
| 571 | 494 | ||
| 572 | ide_set_handler(drive, | 495 | ide_set_handler(drive, |
| 573 | &idefloppy_pc_intr, | 496 | &idefloppy_pc_intr, |
| @@ -584,15 +507,15 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
| 584 | else | 507 | else |
| 585 | xferfunc = hwif->atapi_input_bytes; | 508 | xferfunc = hwif->atapi_input_bytes; |
| 586 | 509 | ||
| 587 | if (pc->buffer) | 510 | if (pc->buf) |
| 588 | xferfunc(drive, pc->current_position, bcount); | 511 | xferfunc(drive, pc->cur_pos, bcount); |
| 589 | else | 512 | else |
| 590 | ide_floppy_io_buffers(drive, pc, bcount, | 513 | ide_floppy_io_buffers(drive, pc, bcount, |
| 591 | !!(pc->flags & PC_FLAG_WRITING)); | 514 | !!(pc->flags & PC_FLAG_WRITING)); |
| 592 | 515 | ||
| 593 | /* Update the current position */ | 516 | /* Update the current position */ |
| 594 | pc->actually_transferred += bcount; | 517 | pc->xferred += bcount; |
| 595 | pc->current_position += bcount; | 518 | pc->cur_pos += bcount; |
| 596 | 519 | ||
| 597 | /* And set the interrupt handler again */ | 520 | /* And set the interrupt handler again */ |
| 598 | ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); | 521 | ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); |
| @@ -606,6 +529,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
| 606 | */ | 529 | */ |
| 607 | static ide_startstop_t idefloppy_transfer_pc(ide_drive_t *drive) | 530 | static ide_startstop_t idefloppy_transfer_pc(ide_drive_t *drive) |
| 608 | { | 531 | { |
| 532 | ide_hwif_t *hwif = drive->hwif; | ||
| 609 | ide_startstop_t startstop; | 533 | ide_startstop_t startstop; |
| 610 | idefloppy_floppy_t *floppy = drive->driver_data; | 534 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 611 | u8 ireason; | 535 | u8 ireason; |
| @@ -615,7 +539,7 @@ static ide_startstop_t idefloppy_transfer_pc(ide_drive_t *drive) | |||
| 615 | "initiated yet DRQ isn't asserted\n"); | 539 | "initiated yet DRQ isn't asserted\n"); |
| 616 | return startstop; | 540 | return startstop; |
| 617 | } | 541 | } |
| 618 | ireason = drive->hwif->INB(IDE_IREASON_REG); | 542 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); |
| 619 | if ((ireason & CD) == 0 || (ireason & IO)) { | 543 | if ((ireason & CD) == 0 || (ireason & IO)) { |
| 620 | printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while " | 544 | printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while " |
| 621 | "issuing a packet command\n"); | 545 | "issuing a packet command\n"); |
| @@ -652,6 +576,7 @@ static int idefloppy_transfer_pc2(ide_drive_t *drive) | |||
| 652 | 576 | ||
| 653 | static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive) | 577 | static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive) |
| 654 | { | 578 | { |
| 579 | ide_hwif_t *hwif = drive->hwif; | ||
| 655 | idefloppy_floppy_t *floppy = drive->driver_data; | 580 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 656 | ide_startstop_t startstop; | 581 | ide_startstop_t startstop; |
| 657 | u8 ireason; | 582 | u8 ireason; |
| @@ -661,7 +586,7 @@ static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive) | |||
| 661 | "initiated yet DRQ isn't asserted\n"); | 586 | "initiated yet DRQ isn't asserted\n"); |
| 662 | return startstop; | 587 | return startstop; |
| 663 | } | 588 | } |
| 664 | ireason = drive->hwif->INB(IDE_IREASON_REG); | 589 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); |
| 665 | if ((ireason & CD) == 0 || (ireason & IO)) { | 590 | if ((ireason & CD) == 0 || (ireason & IO)) { |
| 666 | printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) " | 591 | printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) " |
| 667 | "while issuing a packet command\n"); | 592 | "while issuing a packet command\n"); |
| @@ -682,7 +607,7 @@ static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive) | |||
| 682 | } | 607 | } |
| 683 | 608 | ||
| 684 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, | 609 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, |
| 685 | idefloppy_pc_t *pc) | 610 | struct ide_atapi_pc *pc) |
| 686 | { | 611 | { |
| 687 | /* supress error messages resulting from Medium not present */ | 612 | /* supress error messages resulting from Medium not present */ |
| 688 | if (floppy->sense_key == 0x02 && | 613 | if (floppy->sense_key == 0x02 && |
| @@ -698,7 +623,7 @@ static void ide_floppy_report_error(idefloppy_floppy_t *floppy, | |||
| 698 | } | 623 | } |
| 699 | 624 | ||
| 700 | static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | 625 | static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, |
| 701 | idefloppy_pc_t *pc) | 626 | struct ide_atapi_pc *pc) |
| 702 | { | 627 | { |
| 703 | idefloppy_floppy_t *floppy = drive->driver_data; | 628 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 704 | ide_hwif_t *hwif = drive->hwif; | 629 | ide_hwif_t *hwif = drive->hwif; |
| @@ -719,7 +644,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
| 719 | pc->error = IDEFLOPPY_ERROR_GENERAL; | 644 | pc->error = IDEFLOPPY_ERROR_GENERAL; |
| 720 | 645 | ||
| 721 | floppy->failed_pc = NULL; | 646 | floppy->failed_pc = NULL; |
| 722 | pc->callback(drive); | 647 | pc->idefloppy_callback(drive); |
| 723 | return ide_stopped; | 648 | return ide_stopped; |
| 724 | } | 649 | } |
| 725 | 650 | ||
| @@ -727,9 +652,9 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
| 727 | 652 | ||
| 728 | pc->retries++; | 653 | pc->retries++; |
| 729 | /* We haven't transferred any data yet */ | 654 | /* We haven't transferred any data yet */ |
| 730 | pc->actually_transferred = 0; | 655 | pc->xferred = 0; |
| 731 | pc->current_position = pc->buffer; | 656 | pc->cur_pos = pc->buf; |
| 732 | bcount = min(pc->request_transfer, 63 * 1024); | 657 | bcount = min(pc->req_xfer, 63 * 1024); |
| 733 | 658 | ||
| 734 | if (pc->flags & PC_FLAG_DMA_ERROR) { | 659 | if (pc->flags & PC_FLAG_DMA_ERROR) { |
| 735 | pc->flags &= ~PC_FLAG_DMA_ERROR; | 660 | pc->flags &= ~PC_FLAG_DMA_ERROR; |
| @@ -757,7 +682,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
| 757 | /* immediate */ | 682 | /* immediate */ |
| 758 | pkt_xfer_routine = &idefloppy_transfer_pc; | 683 | pkt_xfer_routine = &idefloppy_transfer_pc; |
| 759 | } | 684 | } |
| 760 | 685 | ||
| 761 | if (floppy->flags & IDEFLOPPY_FLAG_DRQ_INTERRUPT) { | 686 | if (floppy->flags & IDEFLOPPY_FLAG_DRQ_INTERRUPT) { |
| 762 | /* Issue the packet command */ | 687 | /* Issue the packet command */ |
| 763 | ide_execute_command(drive, WIN_PACKETCMD, | 688 | ide_execute_command(drive, WIN_PACKETCMD, |
| @@ -767,7 +692,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
| 767 | return ide_started; | 692 | return ide_started; |
| 768 | } else { | 693 | } else { |
| 769 | /* Issue the packet command */ | 694 | /* Issue the packet command */ |
| 770 | HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG); | 695 | hwif->OUTB(WIN_PACKETCMD, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 771 | return (*pkt_xfer_routine) (drive); | 696 | return (*pkt_xfer_routine) (drive); |
| 772 | } | 697 | } |
| 773 | } | 698 | } |
| @@ -776,11 +701,11 @@ static void idefloppy_rw_callback(ide_drive_t *drive) | |||
| 776 | { | 701 | { |
| 777 | debug_log("Reached %s\n", __func__); | 702 | debug_log("Reached %s\n", __func__); |
| 778 | 703 | ||
| 779 | idefloppy_do_end_request(drive, 1, 0); | 704 | idefloppy_end_request(drive, 1, 0); |
| 780 | return; | 705 | return; |
| 781 | } | 706 | } |
| 782 | 707 | ||
| 783 | static void idefloppy_create_prevent_cmd(idefloppy_pc_t *pc, int prevent) | 708 | static void idefloppy_create_prevent_cmd(struct ide_atapi_pc *pc, int prevent) |
| 784 | { | 709 | { |
| 785 | debug_log("creating prevent removal command, prevent = %d\n", prevent); | 710 | debug_log("creating prevent removal command, prevent = %d\n", prevent); |
| 786 | 711 | ||
| @@ -789,39 +714,39 @@ static void idefloppy_create_prevent_cmd(idefloppy_pc_t *pc, int prevent) | |||
| 789 | pc->c[4] = prevent; | 714 | pc->c[4] = prevent; |
| 790 | } | 715 | } |
| 791 | 716 | ||
| 792 | static void idefloppy_create_read_capacity_cmd(idefloppy_pc_t *pc) | 717 | static void idefloppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) |
| 793 | { | 718 | { |
| 794 | idefloppy_init_pc(pc); | 719 | idefloppy_init_pc(pc); |
| 795 | pc->c[0] = GPCMD_READ_FORMAT_CAPACITIES; | 720 | pc->c[0] = GPCMD_READ_FORMAT_CAPACITIES; |
| 796 | pc->c[7] = 255; | 721 | pc->c[7] = 255; |
| 797 | pc->c[8] = 255; | 722 | pc->c[8] = 255; |
| 798 | pc->request_transfer = 255; | 723 | pc->req_xfer = 255; |
| 799 | } | 724 | } |
| 800 | 725 | ||
| 801 | static void idefloppy_create_format_unit_cmd(idefloppy_pc_t *pc, int b, int l, | 726 | static void idefloppy_create_format_unit_cmd(struct ide_atapi_pc *pc, int b, |
| 802 | int flags) | 727 | int l, int flags) |
| 803 | { | 728 | { |
| 804 | idefloppy_init_pc(pc); | 729 | idefloppy_init_pc(pc); |
| 805 | pc->c[0] = GPCMD_FORMAT_UNIT; | 730 | pc->c[0] = GPCMD_FORMAT_UNIT; |
| 806 | pc->c[1] = 0x17; | 731 | pc->c[1] = 0x17; |
| 807 | 732 | ||
| 808 | memset(pc->buffer, 0, 12); | 733 | memset(pc->buf, 0, 12); |
| 809 | pc->buffer[1] = 0xA2; | 734 | pc->buf[1] = 0xA2; |
| 810 | /* Default format list header, u8 1: FOV/DCRT/IMM bits set */ | 735 | /* Default format list header, u8 1: FOV/DCRT/IMM bits set */ |
| 811 | 736 | ||
| 812 | if (flags & 1) /* Verify bit on... */ | 737 | if (flags & 1) /* Verify bit on... */ |
| 813 | pc->buffer[1] ^= 0x20; /* ... turn off DCRT bit */ | 738 | pc->buf[1] ^= 0x20; /* ... turn off DCRT bit */ |
| 814 | pc->buffer[3] = 8; | 739 | pc->buf[3] = 8; |
| 815 | 740 | ||
| 816 | put_unaligned(cpu_to_be32(b), (unsigned int *)(&pc->buffer[4])); | 741 | put_unaligned(cpu_to_be32(b), (unsigned int *)(&pc->buf[4])); |
| 817 | put_unaligned(cpu_to_be32(l), (unsigned int *)(&pc->buffer[8])); | 742 | put_unaligned(cpu_to_be32(l), (unsigned int *)(&pc->buf[8])); |
| 818 | pc->buffer_size = 12; | 743 | pc->buf_size = 12; |
| 819 | pc->flags |= PC_FLAG_WRITING; | 744 | pc->flags |= PC_FLAG_WRITING; |
| 820 | } | 745 | } |
| 821 | 746 | ||
| 822 | /* A mode sense command is used to "sense" floppy parameters. */ | 747 | /* A mode sense command is used to "sense" floppy parameters. */ |
| 823 | static void idefloppy_create_mode_sense_cmd(idefloppy_pc_t *pc, u8 page_code, | 748 | static void idefloppy_create_mode_sense_cmd(struct ide_atapi_pc *pc, |
| 824 | u8 type) | 749 | u8 page_code, u8 type) |
| 825 | { | 750 | { |
| 826 | u16 length = 8; /* sizeof(Mode Parameter Header) = 8 Bytes */ | 751 | u16 length = 8; /* sizeof(Mode Parameter Header) = 8 Bytes */ |
| 827 | 752 | ||
| @@ -842,24 +767,24 @@ static void idefloppy_create_mode_sense_cmd(idefloppy_pc_t *pc, u8 page_code, | |||
| 842 | "in create_mode_sense_cmd\n"); | 767 | "in create_mode_sense_cmd\n"); |
| 843 | } | 768 | } |
| 844 | put_unaligned(cpu_to_be16(length), (u16 *) &pc->c[7]); | 769 | put_unaligned(cpu_to_be16(length), (u16 *) &pc->c[7]); |
| 845 | pc->request_transfer = length; | 770 | pc->req_xfer = length; |
| 846 | } | 771 | } |
| 847 | 772 | ||
| 848 | static void idefloppy_create_start_stop_cmd(idefloppy_pc_t *pc, int start) | 773 | static void idefloppy_create_start_stop_cmd(struct ide_atapi_pc *pc, int start) |
| 849 | { | 774 | { |
| 850 | idefloppy_init_pc(pc); | 775 | idefloppy_init_pc(pc); |
| 851 | pc->c[0] = GPCMD_START_STOP_UNIT; | 776 | pc->c[0] = GPCMD_START_STOP_UNIT; |
| 852 | pc->c[4] = start; | 777 | pc->c[4] = start; |
| 853 | } | 778 | } |
| 854 | 779 | ||
| 855 | static void idefloppy_create_test_unit_ready_cmd(idefloppy_pc_t *pc) | 780 | static void idefloppy_create_test_unit_ready_cmd(struct ide_atapi_pc *pc) |
| 856 | { | 781 | { |
| 857 | idefloppy_init_pc(pc); | 782 | idefloppy_init_pc(pc); |
| 858 | pc->c[0] = GPCMD_TEST_UNIT_READY; | 783 | pc->c[0] = GPCMD_TEST_UNIT_READY; |
| 859 | } | 784 | } |
| 860 | 785 | ||
| 861 | static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, | 786 | static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, |
| 862 | idefloppy_pc_t *pc, struct request *rq, | 787 | struct ide_atapi_pc *pc, struct request *rq, |
| 863 | unsigned long sector) | 788 | unsigned long sector) |
| 864 | { | 789 | { |
| 865 | int block = sector / floppy->bs_factor; | 790 | int block = sector / floppy->bs_factor; |
| @@ -874,41 +799,41 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, | |||
| 874 | put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]); | 799 | put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]); |
| 875 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]); | 800 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]); |
| 876 | 801 | ||
| 877 | pc->callback = &idefloppy_rw_callback; | 802 | pc->idefloppy_callback = &idefloppy_rw_callback; |
| 878 | pc->rq = rq; | 803 | pc->rq = rq; |
| 879 | pc->b_count = cmd == READ ? 0 : rq->bio->bi_size; | 804 | pc->b_count = cmd == READ ? 0 : rq->bio->bi_size; |
| 880 | if (rq->cmd_flags & REQ_RW) | 805 | if (rq->cmd_flags & REQ_RW) |
| 881 | pc->flags |= PC_FLAG_WRITING; | 806 | pc->flags |= PC_FLAG_WRITING; |
| 882 | pc->buffer = NULL; | 807 | pc->buf = NULL; |
| 883 | pc->request_transfer = pc->buffer_size = blocks * floppy->block_size; | 808 | pc->req_xfer = pc->buf_size = blocks * floppy->block_size; |
| 884 | pc->flags |= PC_FLAG_DMA_RECOMMENDED; | 809 | pc->flags |= PC_FLAG_DMA_RECOMMENDED; |
| 885 | } | 810 | } |
| 886 | 811 | ||
| 887 | static void idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy, | 812 | static void idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy, |
| 888 | idefloppy_pc_t *pc, struct request *rq) | 813 | struct ide_atapi_pc *pc, struct request *rq) |
| 889 | { | 814 | { |
| 890 | idefloppy_init_pc(pc); | 815 | idefloppy_init_pc(pc); |
| 891 | pc->callback = &idefloppy_rw_callback; | 816 | pc->idefloppy_callback = &idefloppy_rw_callback; |
| 892 | memcpy(pc->c, rq->cmd, sizeof(pc->c)); | 817 | memcpy(pc->c, rq->cmd, sizeof(pc->c)); |
| 893 | pc->rq = rq; | 818 | pc->rq = rq; |
| 894 | pc->b_count = rq->data_len; | 819 | pc->b_count = rq->data_len; |
| 895 | if (rq->data_len && rq_data_dir(rq) == WRITE) | 820 | if (rq->data_len && rq_data_dir(rq) == WRITE) |
| 896 | pc->flags |= PC_FLAG_WRITING; | 821 | pc->flags |= PC_FLAG_WRITING; |
| 897 | pc->buffer = rq->data; | 822 | pc->buf = rq->data; |
| 898 | if (rq->bio) | 823 | if (rq->bio) |
| 899 | pc->flags |= PC_FLAG_DMA_RECOMMENDED; | 824 | pc->flags |= PC_FLAG_DMA_RECOMMENDED; |
| 900 | /* | 825 | /* |
| 901 | * possibly problematic, doesn't look like ide-floppy correctly | 826 | * possibly problematic, doesn't look like ide-floppy correctly |
| 902 | * handled scattered requests if dma fails... | 827 | * handled scattered requests if dma fails... |
| 903 | */ | 828 | */ |
| 904 | pc->request_transfer = pc->buffer_size = rq->data_len; | 829 | pc->req_xfer = pc->buf_size = rq->data_len; |
| 905 | } | 830 | } |
| 906 | 831 | ||
| 907 | static ide_startstop_t idefloppy_do_request(ide_drive_t *drive, | 832 | static ide_startstop_t idefloppy_do_request(ide_drive_t *drive, |
| 908 | struct request *rq, sector_t block_s) | 833 | struct request *rq, sector_t block_s) |
| 909 | { | 834 | { |
| 910 | idefloppy_floppy_t *floppy = drive->driver_data; | 835 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 911 | idefloppy_pc_t *pc; | 836 | struct ide_atapi_pc *pc; |
| 912 | unsigned long block = (unsigned long)block_s; | 837 | unsigned long block = (unsigned long)block_s; |
| 913 | 838 | ||
| 914 | debug_log("dev: %s, cmd_type: %x, errors: %d\n", | 839 | debug_log("dev: %s, cmd_type: %x, errors: %d\n", |
| @@ -924,7 +849,7 @@ static ide_startstop_t idefloppy_do_request(ide_drive_t *drive, | |||
| 924 | else | 849 | else |
| 925 | printk(KERN_ERR "ide-floppy: %s: I/O error\n", | 850 | printk(KERN_ERR "ide-floppy: %s: I/O error\n", |
| 926 | drive->name); | 851 | drive->name); |
| 927 | idefloppy_do_end_request(drive, 0, 0); | 852 | idefloppy_end_request(drive, 0, 0); |
| 928 | return ide_stopped; | 853 | return ide_stopped; |
| 929 | } | 854 | } |
| 930 | if (blk_fs_request(rq)) { | 855 | if (blk_fs_request(rq)) { |
| @@ -932,20 +857,20 @@ static ide_startstop_t idefloppy_do_request(ide_drive_t *drive, | |||
| 932 | (rq->nr_sectors % floppy->bs_factor)) { | 857 | (rq->nr_sectors % floppy->bs_factor)) { |
| 933 | printk(KERN_ERR "%s: unsupported r/w request size\n", | 858 | printk(KERN_ERR "%s: unsupported r/w request size\n", |
| 934 | drive->name); | 859 | drive->name); |
| 935 | idefloppy_do_end_request(drive, 0, 0); | 860 | idefloppy_end_request(drive, 0, 0); |
| 936 | return ide_stopped; | 861 | return ide_stopped; |
| 937 | } | 862 | } |
| 938 | pc = idefloppy_next_pc_storage(drive); | 863 | pc = idefloppy_next_pc_storage(drive); |
| 939 | idefloppy_create_rw_cmd(floppy, pc, rq, block); | 864 | idefloppy_create_rw_cmd(floppy, pc, rq, block); |
| 940 | } else if (blk_special_request(rq)) { | 865 | } else if (blk_special_request(rq)) { |
| 941 | pc = (idefloppy_pc_t *) rq->buffer; | 866 | pc = (struct ide_atapi_pc *) rq->buffer; |
| 942 | } else if (blk_pc_request(rq)) { | 867 | } else if (blk_pc_request(rq)) { |
| 943 | pc = idefloppy_next_pc_storage(drive); | 868 | pc = idefloppy_next_pc_storage(drive); |
| 944 | idefloppy_blockpc_cmd(floppy, pc, rq); | 869 | idefloppy_blockpc_cmd(floppy, pc, rq); |
| 945 | } else { | 870 | } else { |
| 946 | blk_dump_rq_flags(rq, | 871 | blk_dump_rq_flags(rq, |
| 947 | "ide-floppy: unsupported command in queue"); | 872 | "ide-floppy: unsupported command in queue"); |
| 948 | idefloppy_do_end_request(drive, 0, 0); | 873 | idefloppy_end_request(drive, 0, 0); |
| 949 | return ide_stopped; | 874 | return ide_stopped; |
| 950 | } | 875 | } |
| 951 | 876 | ||
| @@ -957,7 +882,7 @@ static ide_startstop_t idefloppy_do_request(ide_drive_t *drive, | |||
| 957 | * Add a special packet command request to the tail of the request queue, | 882 | * Add a special packet command request to the tail of the request queue, |
| 958 | * and wait for it to be serviced. | 883 | * and wait for it to be serviced. |
| 959 | */ | 884 | */ |
| 960 | static int idefloppy_queue_pc_tail(ide_drive_t *drive, idefloppy_pc_t *pc) | 885 | static int idefloppy_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) |
| 961 | { | 886 | { |
| 962 | struct ide_floppy_obj *floppy = drive->driver_data; | 887 | struct ide_floppy_obj *floppy = drive->driver_data; |
| 963 | struct request rq; | 888 | struct request rq; |
| @@ -977,7 +902,7 @@ static int idefloppy_queue_pc_tail(ide_drive_t *drive, idefloppy_pc_t *pc) | |||
| 977 | static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) | 902 | static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) |
| 978 | { | 903 | { |
| 979 | idefloppy_floppy_t *floppy = drive->driver_data; | 904 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 980 | idefloppy_pc_t pc; | 905 | struct ide_atapi_pc pc; |
| 981 | u8 *page; | 906 | u8 *page; |
| 982 | int capacity, lba_capacity; | 907 | int capacity, lba_capacity; |
| 983 | u16 transfer_rate, sector_size, cyls, rpm; | 908 | u16 transfer_rate, sector_size, cyls, rpm; |
| @@ -991,16 +916,16 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) | |||
| 991 | " parameters\n"); | 916 | " parameters\n"); |
| 992 | return 1; | 917 | return 1; |
| 993 | } | 918 | } |
| 994 | floppy->wp = !!(pc.buffer[3] & 0x80); | 919 | floppy->wp = !!(pc.buf[3] & 0x80); |
| 995 | set_disk_ro(floppy->disk, floppy->wp); | 920 | set_disk_ro(floppy->disk, floppy->wp); |
| 996 | page = &pc.buffer[8]; | 921 | page = &pc.buf[8]; |
| 997 | 922 | ||
| 998 | transfer_rate = be16_to_cpu(*(u16 *)&pc.buffer[8 + 2]); | 923 | transfer_rate = be16_to_cpu(*(u16 *)&pc.buf[8 + 2]); |
| 999 | sector_size = be16_to_cpu(*(u16 *)&pc.buffer[8 + 6]); | 924 | sector_size = be16_to_cpu(*(u16 *)&pc.buf[8 + 6]); |
| 1000 | cyls = be16_to_cpu(*(u16 *)&pc.buffer[8 + 8]); | 925 | cyls = be16_to_cpu(*(u16 *)&pc.buf[8 + 8]); |
| 1001 | rpm = be16_to_cpu(*(u16 *)&pc.buffer[8 + 28]); | 926 | rpm = be16_to_cpu(*(u16 *)&pc.buf[8 + 28]); |
| 1002 | heads = pc.buffer[8 + 4]; | 927 | heads = pc.buf[8 + 4]; |
| 1003 | sectors = pc.buffer[8 + 5]; | 928 | sectors = pc.buf[8 + 5]; |
| 1004 | 929 | ||
| 1005 | capacity = cyls * heads * sectors * sector_size; | 930 | capacity = cyls * heads * sectors * sector_size; |
| 1006 | 931 | ||
| @@ -1029,7 +954,7 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) | |||
| 1029 | static int idefloppy_get_sfrp_bit(ide_drive_t *drive) | 954 | static int idefloppy_get_sfrp_bit(ide_drive_t *drive) |
| 1030 | { | 955 | { |
| 1031 | idefloppy_floppy_t *floppy = drive->driver_data; | 956 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 1032 | idefloppy_pc_t pc; | 957 | struct ide_atapi_pc pc; |
| 1033 | 958 | ||
| 1034 | floppy->srfp = 0; | 959 | floppy->srfp = 0; |
| 1035 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE, | 960 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE, |
| @@ -1039,7 +964,7 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive) | |||
| 1039 | if (idefloppy_queue_pc_tail(drive, &pc)) | 964 | if (idefloppy_queue_pc_tail(drive, &pc)) |
| 1040 | return 1; | 965 | return 1; |
| 1041 | 966 | ||
| 1042 | floppy->srfp = pc.buffer[8 + 2] & 0x40; | 967 | floppy->srfp = pc.buf[8 + 2] & 0x40; |
| 1043 | return (0); | 968 | return (0); |
| 1044 | } | 969 | } |
| 1045 | 970 | ||
| @@ -1050,7 +975,7 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive) | |||
| 1050 | static int ide_floppy_get_capacity(ide_drive_t *drive) | 975 | static int ide_floppy_get_capacity(ide_drive_t *drive) |
| 1051 | { | 976 | { |
| 1052 | idefloppy_floppy_t *floppy = drive->driver_data; | 977 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 1053 | idefloppy_pc_t pc; | 978 | struct ide_atapi_pc pc; |
| 1054 | u8 *cap_desc; | 979 | u8 *cap_desc; |
| 1055 | u8 header_len, desc_cnt; | 980 | u8 header_len, desc_cnt; |
| 1056 | int i, rc = 1, blocks, length; | 981 | int i, rc = 1, blocks, length; |
| @@ -1066,15 +991,15 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
| 1066 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); | 991 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); |
| 1067 | return 1; | 992 | return 1; |
| 1068 | } | 993 | } |
| 1069 | header_len = pc.buffer[3]; | 994 | header_len = pc.buf[3]; |
| 1070 | cap_desc = &pc.buffer[4]; | 995 | cap_desc = &pc.buf[4]; |
| 1071 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ | 996 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ |
| 1072 | 997 | ||
| 1073 | for (i = 0; i < desc_cnt; i++) { | 998 | for (i = 0; i < desc_cnt; i++) { |
| 1074 | unsigned int desc_start = 4 + i*8; | 999 | unsigned int desc_start = 4 + i*8; |
| 1075 | 1000 | ||
| 1076 | blocks = be32_to_cpu(*(u32 *)&pc.buffer[desc_start]); | 1001 | blocks = be32_to_cpu(*(u32 *)&pc.buf[desc_start]); |
| 1077 | length = be16_to_cpu(*(u16 *)&pc.buffer[desc_start + 6]); | 1002 | length = be16_to_cpu(*(u16 *)&pc.buf[desc_start + 6]); |
| 1078 | 1003 | ||
| 1079 | debug_log("Descriptor %d: %dkB, %d blocks, %d sector size\n", | 1004 | debug_log("Descriptor %d: %dkB, %d blocks, %d sector size\n", |
| 1080 | i, blocks * length / 1024, blocks, length); | 1005 | i, blocks * length / 1024, blocks, length); |
| @@ -1085,7 +1010,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
| 1085 | * the code below is valid only for the 1st descriptor, ie i=0 | 1010 | * the code below is valid only for the 1st descriptor, ie i=0 |
| 1086 | */ | 1011 | */ |
| 1087 | 1012 | ||
| 1088 | switch (pc.buffer[desc_start + 4] & 0x03) { | 1013 | switch (pc.buf[desc_start + 4] & 0x03) { |
| 1089 | /* Clik! drive returns this instead of CAPACITY_CURRENT */ | 1014 | /* Clik! drive returns this instead of CAPACITY_CURRENT */ |
| 1090 | case CAPACITY_UNFORMATTED: | 1015 | case CAPACITY_UNFORMATTED: |
| 1091 | if (!(floppy->flags & IDEFLOPPY_FLAG_CLIK_DRIVE)) | 1016 | if (!(floppy->flags & IDEFLOPPY_FLAG_CLIK_DRIVE)) |
| @@ -1130,7 +1055,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
| 1130 | break; | 1055 | break; |
| 1131 | } | 1056 | } |
| 1132 | debug_log("Descriptor 0 Code: %d\n", | 1057 | debug_log("Descriptor 0 Code: %d\n", |
| 1133 | pc.buffer[desc_start + 4] & 0x03); | 1058 | pc.buf[desc_start + 4] & 0x03); |
| 1134 | } | 1059 | } |
| 1135 | 1060 | ||
| 1136 | /* Clik! disk does not support get_flexible_disk_page */ | 1061 | /* Clik! disk does not support get_flexible_disk_page */ |
| @@ -1162,7 +1087,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
| 1162 | 1087 | ||
| 1163 | static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | 1088 | static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) |
| 1164 | { | 1089 | { |
| 1165 | idefloppy_pc_t pc; | 1090 | struct ide_atapi_pc pc; |
| 1166 | u8 header_len, desc_cnt; | 1091 | u8 header_len, desc_cnt; |
| 1167 | int i, blocks, length, u_array_size, u_index; | 1092 | int i, blocks, length, u_array_size, u_index; |
| 1168 | int __user *argp; | 1093 | int __user *argp; |
| @@ -1178,7 +1103,7 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | |||
| 1178 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); | 1103 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); |
| 1179 | return (-EIO); | 1104 | return (-EIO); |
| 1180 | } | 1105 | } |
| 1181 | header_len = pc.buffer[3]; | 1106 | header_len = pc.buf[3]; |
| 1182 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ | 1107 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ |
| 1183 | 1108 | ||
| 1184 | u_index = 0; | 1109 | u_index = 0; |
| @@ -1195,8 +1120,8 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | |||
| 1195 | if (u_index >= u_array_size) | 1120 | if (u_index >= u_array_size) |
| 1196 | break; /* User-supplied buffer too small */ | 1121 | break; /* User-supplied buffer too small */ |
| 1197 | 1122 | ||
| 1198 | blocks = be32_to_cpu(*(u32 *)&pc.buffer[desc_start]); | 1123 | blocks = be32_to_cpu(*(u32 *)&pc.buf[desc_start]); |
| 1199 | length = be16_to_cpu(*(u16 *)&pc.buffer[desc_start + 6]); | 1124 | length = be16_to_cpu(*(u16 *)&pc.buf[desc_start + 6]); |
| 1200 | 1125 | ||
| 1201 | if (put_user(blocks, argp)) | 1126 | if (put_user(blocks, argp)) |
| 1202 | return(-EFAULT); | 1127 | return(-EFAULT); |
| @@ -1227,7 +1152,7 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | |||
| 1227 | static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) | 1152 | static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) |
| 1228 | { | 1153 | { |
| 1229 | idefloppy_floppy_t *floppy = drive->driver_data; | 1154 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 1230 | idefloppy_pc_t pc; | 1155 | struct ide_atapi_pc pc; |
| 1231 | int progress_indication = 0x10000; | 1156 | int progress_indication = 0x10000; |
| 1232 | 1157 | ||
| 1233 | if (floppy->srfp) { | 1158 | if (floppy->srfp) { |
| @@ -1271,33 +1196,39 @@ static sector_t idefloppy_capacity(ide_drive_t *drive) | |||
| 1271 | */ | 1196 | */ |
| 1272 | static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id) | 1197 | static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id) |
| 1273 | { | 1198 | { |
| 1274 | struct idefloppy_id_gcw gcw; | 1199 | u8 gcw[2]; |
| 1200 | u8 device_type, protocol, removable, drq_type, packet_size; | ||
| 1275 | 1201 | ||
| 1276 | *((u16 *) &gcw) = id->config; | 1202 | *((u16 *) &gcw) = id->config; |
| 1277 | 1203 | ||
| 1204 | device_type = gcw[1] & 0x1F; | ||
| 1205 | removable = (gcw[0] & 0x80) >> 7; | ||
| 1206 | protocol = (gcw[1] & 0xC0) >> 6; | ||
| 1207 | drq_type = (gcw[0] & 0x60) >> 5; | ||
| 1208 | packet_size = gcw[0] & 0x03; | ||
| 1209 | |||
| 1278 | #ifdef CONFIG_PPC | 1210 | #ifdef CONFIG_PPC |
| 1279 | /* kludge for Apple PowerBook internal zip */ | 1211 | /* kludge for Apple PowerBook internal zip */ |
| 1280 | if ((gcw.device_type == 5) && | 1212 | if (device_type == 5 && |
| 1281 | !strstr(id->model, "CD-ROM") && | 1213 | !strstr(id->model, "CD-ROM") && strstr(id->model, "ZIP")) |
| 1282 | strstr(id->model, "ZIP")) | 1214 | device_type = 0; |
| 1283 | gcw.device_type = 0; | ||
| 1284 | #endif | 1215 | #endif |
| 1285 | 1216 | ||
| 1286 | if (gcw.protocol != 2) | 1217 | if (protocol != 2) |
| 1287 | printk(KERN_ERR "ide-floppy: Protocol (0x%02x) is not ATAPI\n", | 1218 | printk(KERN_ERR "ide-floppy: Protocol (0x%02x) is not ATAPI\n", |
| 1288 | gcw.protocol); | 1219 | protocol); |
| 1289 | else if (gcw.device_type != 0) | 1220 | else if (device_type != 0) |
| 1290 | printk(KERN_ERR "ide-floppy: Device type (0x%02x) is not set " | 1221 | printk(KERN_ERR "ide-floppy: Device type (0x%02x) is not set " |
| 1291 | "to floppy\n", gcw.device_type); | 1222 | "to floppy\n", device_type); |
| 1292 | else if (!gcw.removable) | 1223 | else if (!removable) |
| 1293 | printk(KERN_ERR "ide-floppy: The removable flag is not set\n"); | 1224 | printk(KERN_ERR "ide-floppy: The removable flag is not set\n"); |
| 1294 | else if (gcw.drq_type == 3) { | 1225 | else if (drq_type == 3) |
| 1295 | printk(KERN_ERR "ide-floppy: Sorry, DRQ type (0x%02x) not " | 1226 | printk(KERN_ERR "ide-floppy: Sorry, DRQ type (0x%02x) not " |
| 1296 | "supported\n", gcw.drq_type); | 1227 | "supported\n", drq_type); |
| 1297 | } else if (gcw.packet_size != 0) { | 1228 | else if (packet_size != 0) |
| 1298 | printk(KERN_ERR "ide-floppy: Packet size (0x%02x) is not 12 " | 1229 | printk(KERN_ERR "ide-floppy: Packet size (0x%02x) is not 12 " |
| 1299 | "bytes long\n", gcw.packet_size); | 1230 | "bytes\n", packet_size); |
| 1300 | } else | 1231 | else |
| 1301 | return 1; | 1232 | return 1; |
| 1302 | return 0; | 1233 | return 0; |
| 1303 | } | 1234 | } |
| @@ -1322,11 +1253,12 @@ static inline void idefloppy_add_settings(ide_drive_t *drive) { ; } | |||
| 1322 | 1253 | ||
| 1323 | static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) | 1254 | static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) |
| 1324 | { | 1255 | { |
| 1325 | struct idefloppy_id_gcw gcw; | 1256 | u8 gcw[2]; |
| 1326 | 1257 | ||
| 1327 | *((u16 *) &gcw) = drive->id->config; | 1258 | *((u16 *) &gcw) = drive->id->config; |
| 1328 | floppy->pc = floppy->pc_stack; | 1259 | floppy->pc = floppy->pc_stack; |
| 1329 | if (gcw.drq_type == 1) | 1260 | |
| 1261 | if (((gcw[0] & 0x60) >> 5) == 1) | ||
| 1330 | floppy->flags |= IDEFLOPPY_FLAG_DRQ_INTERRUPT; | 1262 | floppy->flags |= IDEFLOPPY_FLAG_DRQ_INTERRUPT; |
| 1331 | /* | 1263 | /* |
| 1332 | * We used to check revisions here. At this point however I'm giving up. | 1264 | * We used to check revisions here. At this point however I'm giving up. |
| @@ -1413,7 +1345,7 @@ static ide_driver_t idefloppy_driver = { | |||
| 1413 | .media = ide_floppy, | 1345 | .media = ide_floppy, |
| 1414 | .supports_dsc_overlap = 0, | 1346 | .supports_dsc_overlap = 0, |
| 1415 | .do_request = idefloppy_do_request, | 1347 | .do_request = idefloppy_do_request, |
| 1416 | .end_request = idefloppy_do_end_request, | 1348 | .end_request = idefloppy_end_request, |
| 1417 | .error = __ide_error, | 1349 | .error = __ide_error, |
| 1418 | .abort = __ide_abort, | 1350 | .abort = __ide_abort, |
| 1419 | #ifdef CONFIG_IDE_PROC_FS | 1351 | #ifdef CONFIG_IDE_PROC_FS |
| @@ -1426,7 +1358,7 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
| 1426 | struct gendisk *disk = inode->i_bdev->bd_disk; | 1358 | struct gendisk *disk = inode->i_bdev->bd_disk; |
| 1427 | struct ide_floppy_obj *floppy; | 1359 | struct ide_floppy_obj *floppy; |
| 1428 | ide_drive_t *drive; | 1360 | ide_drive_t *drive; |
| 1429 | idefloppy_pc_t pc; | 1361 | struct ide_atapi_pc pc; |
| 1430 | int ret = 0; | 1362 | int ret = 0; |
| 1431 | 1363 | ||
| 1432 | debug_log("Reached %s\n", __func__); | 1364 | debug_log("Reached %s\n", __func__); |
| @@ -1489,7 +1421,7 @@ static int idefloppy_release(struct inode *inode, struct file *filp) | |||
| 1489 | struct gendisk *disk = inode->i_bdev->bd_disk; | 1421 | struct gendisk *disk = inode->i_bdev->bd_disk; |
| 1490 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); | 1422 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); |
| 1491 | ide_drive_t *drive = floppy->drive; | 1423 | ide_drive_t *drive = floppy->drive; |
| 1492 | idefloppy_pc_t pc; | 1424 | struct ide_atapi_pc pc; |
| 1493 | 1425 | ||
| 1494 | debug_log("Reached %s\n", __func__); | 1426 | debug_log("Reached %s\n", __func__); |
| 1495 | 1427 | ||
| @@ -1521,8 +1453,8 @@ static int idefloppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
| 1521 | return 0; | 1453 | return 0; |
| 1522 | } | 1454 | } |
| 1523 | 1455 | ||
| 1524 | static int ide_floppy_lockdoor(idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, | 1456 | static int ide_floppy_lockdoor(idefloppy_floppy_t *floppy, |
| 1525 | unsigned long arg, unsigned int cmd) | 1457 | struct ide_atapi_pc *pc, unsigned long arg, unsigned int cmd) |
| 1526 | { | 1458 | { |
| 1527 | if (floppy->openers > 1) | 1459 | if (floppy->openers > 1) |
| 1528 | return -EBUSY; | 1460 | return -EBUSY; |
| @@ -1551,7 +1483,7 @@ static int ide_floppy_format_unit(idefloppy_floppy_t *floppy, | |||
| 1551 | int __user *arg) | 1483 | int __user *arg) |
| 1552 | { | 1484 | { |
| 1553 | int blocks, length, flags, err = 0; | 1485 | int blocks, length, flags, err = 0; |
| 1554 | idefloppy_pc_t pc; | 1486 | struct ide_atapi_pc pc; |
| 1555 | 1487 | ||
| 1556 | if (floppy->openers > 1) { | 1488 | if (floppy->openers > 1) { |
| 1557 | /* Don't format if someone is using the disk */ | 1489 | /* Don't format if someone is using the disk */ |
| @@ -1602,7 +1534,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, | |||
| 1602 | struct block_device *bdev = inode->i_bdev; | 1534 | struct block_device *bdev = inode->i_bdev; |
| 1603 | struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk); | 1535 | struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk); |
| 1604 | ide_drive_t *drive = floppy->drive; | 1536 | ide_drive_t *drive = floppy->drive; |
| 1605 | idefloppy_pc_t pc; | 1537 | struct ide_atapi_pc pc; |
| 1606 | void __user *argp = (void __user *)arg; | 1538 | void __user *argp = (void __user *)arg; |
| 1607 | int err; | 1539 | int err; |
| 1608 | 1540 | ||
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c index 9ebec08eefd9..25fda0a3263f 100644 --- a/drivers/ide/ide-generic.c +++ b/drivers/ide/ide-generic.c | |||
| @@ -1,17 +1,89 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * generic/default IDE host driver | 2 | * generic/default IDE host driver |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2004 Bartlomiej Zolnierkiewicz | 4 | * Copyright (C) 2004, 2008 Bartlomiej Zolnierkiewicz |
| 5 | * This code was split off from ide.c. See it for original copyrights. | 5 | * This code was split off from ide.c. See it for original copyrights. |
| 6 | * | 6 | * |
| 7 | * May be copied or modified under the terms of the GNU General Public License. | 7 | * May be copied or modified under the terms of the GNU General Public License. |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | /* | ||
| 11 | * For special cases new interfaces may be added using sysfs, i.e. | ||
| 12 | * | ||
| 13 | * echo -n "0x168:0x36e:10" > /sys/class/ide_generic/add | ||
| 14 | * | ||
| 15 | * will add an interface using I/O ports 0x168-0x16f/0x36e and IRQ 10. | ||
| 16 | */ | ||
| 17 | |||
| 10 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 11 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 12 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 13 | #include <linux/ide.h> | 21 | #include <linux/ide.h> |
| 14 | 22 | ||
| 23 | #define DRV_NAME "ide_generic" | ||
| 24 | |||
| 25 | static ssize_t store_add(struct class *cls, const char *buf, size_t n) | ||
| 26 | { | ||
| 27 | ide_hwif_t *hwif; | ||
| 28 | unsigned int base, ctl; | ||
| 29 | int irq; | ||
| 30 | hw_regs_t hw; | ||
| 31 | u8 idx[] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 32 | |||
| 33 | if (sscanf(buf, "%x:%x:%d", &base, &ctl, &irq) != 3) | ||
| 34 | return -EINVAL; | ||
| 35 | |||
| 36 | hwif = ide_find_port(base); | ||
| 37 | if (hwif == NULL) | ||
| 38 | return -ENOENT; | ||
| 39 | |||
| 40 | memset(&hw, 0, sizeof(hw)); | ||
| 41 | ide_std_init_ports(&hw, base, ctl); | ||
| 42 | hw.irq = irq; | ||
| 43 | hw.chipset = ide_generic; | ||
| 44 | |||
| 45 | ide_init_port_hw(hwif, &hw); | ||
| 46 | |||
| 47 | idx[0] = hwif->index; | ||
| 48 | |||
| 49 | ide_device_add(idx, NULL); | ||
| 50 | |||
| 51 | return n; | ||
| 52 | }; | ||
| 53 | |||
| 54 | static struct class_attribute ide_generic_class_attrs[] = { | ||
| 55 | __ATTR(add, S_IWUSR, NULL, store_add), | ||
| 56 | __ATTR_NULL | ||
| 57 | }; | ||
| 58 | |||
| 59 | static void ide_generic_class_release(struct class *cls) | ||
| 60 | { | ||
| 61 | kfree(cls); | ||
| 62 | } | ||
| 63 | |||
| 64 | static int __init ide_generic_sysfs_init(void) | ||
| 65 | { | ||
| 66 | struct class *cls; | ||
| 67 | int rc; | ||
| 68 | |||
| 69 | cls = kzalloc(sizeof(*cls), GFP_KERNEL); | ||
| 70 | if (!cls) | ||
| 71 | return -ENOMEM; | ||
| 72 | |||
| 73 | cls->name = DRV_NAME; | ||
| 74 | cls->owner = THIS_MODULE; | ||
| 75 | cls->class_release = ide_generic_class_release; | ||
| 76 | cls->class_attrs = ide_generic_class_attrs; | ||
| 77 | |||
| 78 | rc = class_register(cls); | ||
| 79 | if (rc) { | ||
| 80 | kfree(cls); | ||
| 81 | return rc; | ||
| 82 | } | ||
| 83 | |||
| 84 | return 0; | ||
| 85 | } | ||
| 86 | |||
| 15 | static int __init ide_generic_init(void) | 87 | static int __init ide_generic_init(void) |
| 16 | { | 88 | { |
| 17 | u8 idx[MAX_HWIFS]; | 89 | u8 idx[MAX_HWIFS]; |
| @@ -19,15 +91,26 @@ static int __init ide_generic_init(void) | |||
| 19 | 91 | ||
| 20 | for (i = 0; i < MAX_HWIFS; i++) { | 92 | for (i = 0; i < MAX_HWIFS; i++) { |
| 21 | ide_hwif_t *hwif = &ide_hwifs[i]; | 93 | ide_hwif_t *hwif = &ide_hwifs[i]; |
| 94 | unsigned long io_addr = ide_default_io_base(i); | ||
| 95 | hw_regs_t hw; | ||
| 96 | |||
| 97 | if (hwif->chipset == ide_unknown && io_addr) { | ||
| 98 | memset(&hw, 0, sizeof(hw)); | ||
| 99 | ide_std_init_ports(&hw, io_addr, io_addr + 0x206); | ||
| 100 | hw.irq = ide_default_irq(io_addr); | ||
| 101 | ide_init_port_hw(hwif, &hw); | ||
| 22 | 102 | ||
| 23 | if (hwif->io_ports[IDE_DATA_OFFSET] && !hwif->present) | ||
| 24 | idx[i] = i; | 103 | idx[i] = i; |
| 25 | else | 104 | } else |
| 26 | idx[i] = 0xff; | 105 | idx[i] = 0xff; |
| 27 | } | 106 | } |
| 28 | 107 | ||
| 29 | ide_device_add_all(idx, NULL); | 108 | ide_device_add_all(idx, NULL); |
| 30 | 109 | ||
| 110 | if (ide_generic_sysfs_init()) | ||
| 111 | printk(KERN_ERR DRV_NAME ": failed to create ide_generic " | ||
| 112 | "class\n"); | ||
| 113 | |||
| 31 | return 0; | 114 | return 0; |
| 32 | } | 115 | } |
| 33 | 116 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 715379605a7b..31e5afadb7e9 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
| @@ -301,39 +301,45 @@ void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
| 301 | struct ide_taskfile *tf = &task->tf; | 301 | struct ide_taskfile *tf = &task->tf; |
| 302 | 302 | ||
| 303 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 303 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { |
| 304 | u16 data = hwif->INW(IDE_DATA_REG); | 304 | u16 data = hwif->INW(hwif->io_ports[IDE_DATA_OFFSET]); |
| 305 | 305 | ||
| 306 | tf->data = data & 0xff; | 306 | tf->data = data & 0xff; |
| 307 | tf->hob_data = (data >> 8) & 0xff; | 307 | tf->hob_data = (data >> 8) & 0xff; |
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | /* be sure we're looking at the low order bits */ | 310 | /* be sure we're looking at the low order bits */ |
| 311 | hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG); | 311 | hwif->OUTB(drive->ctl & ~0x80, hwif->io_ports[IDE_CONTROL_OFFSET]); |
| 312 | 312 | ||
| 313 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 313 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) |
| 314 | tf->nsect = hwif->INB(IDE_NSECTOR_REG); | 314 | tf->nsect = hwif->INB(hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 315 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 315 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) |
| 316 | tf->lbal = hwif->INB(IDE_SECTOR_REG); | 316 | tf->lbal = hwif->INB(hwif->io_ports[IDE_SECTOR_OFFSET]); |
| 317 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 317 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) |
| 318 | tf->lbam = hwif->INB(IDE_LCYL_REG); | 318 | tf->lbam = hwif->INB(hwif->io_ports[IDE_LCYL_OFFSET]); |
| 319 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 319 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) |
| 320 | tf->lbah = hwif->INB(IDE_HCYL_REG); | 320 | tf->lbah = hwif->INB(hwif->io_ports[IDE_HCYL_OFFSET]); |
| 321 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 321 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) |
| 322 | tf->device = hwif->INB(IDE_SELECT_REG); | 322 | tf->device = hwif->INB(hwif->io_ports[IDE_SELECT_OFFSET]); |
| 323 | 323 | ||
| 324 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 324 | if (task->tf_flags & IDE_TFLAG_LBA48) { |
| 325 | hwif->OUTB(drive->ctl | 0x80, IDE_CONTROL_REG); | 325 | hwif->OUTB(drive->ctl | 0x80, |
| 326 | hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
| 326 | 327 | ||
| 327 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 328 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
| 328 | tf->hob_feature = hwif->INB(IDE_FEATURE_REG); | 329 | tf->hob_feature = |
| 330 | hwif->INB(hwif->io_ports[IDE_FEATURE_OFFSET]); | ||
| 329 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 331 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
| 330 | tf->hob_nsect = hwif->INB(IDE_NSECTOR_REG); | 332 | tf->hob_nsect = |
| 333 | hwif->INB(hwif->io_ports[IDE_NSECTOR_OFFSET]); | ||
| 331 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 334 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
| 332 | tf->hob_lbal = hwif->INB(IDE_SECTOR_REG); | 335 | tf->hob_lbal = |
| 336 | hwif->INB(hwif->io_ports[IDE_SECTOR_OFFSET]); | ||
| 333 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 337 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
| 334 | tf->hob_lbam = hwif->INB(IDE_LCYL_REG); | 338 | tf->hob_lbam = |
| 339 | hwif->INB(hwif->io_ports[IDE_LCYL_OFFSET]); | ||
| 335 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 340 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
| 336 | tf->hob_lbah = hwif->INB(IDE_HCYL_REG); | 341 | tf->hob_lbah = |
| 342 | hwif->INB(hwif->io_ports[IDE_HCYL_OFFSET]); | ||
| 337 | } | 343 | } |
| 338 | } | 344 | } |
| 339 | 345 | ||
| @@ -448,7 +454,8 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
| 448 | if (err == ABRT_ERR) { | 454 | if (err == ABRT_ERR) { |
| 449 | if (drive->select.b.lba && | 455 | if (drive->select.b.lba && |
| 450 | /* some newer drives don't support WIN_SPECIFY */ | 456 | /* some newer drives don't support WIN_SPECIFY */ |
| 451 | hwif->INB(IDE_COMMAND_REG) == WIN_SPECIFY) | 457 | hwif->INB(hwif->io_ports[IDE_COMMAND_OFFSET]) == |
| 458 | WIN_SPECIFY) | ||
| 452 | return ide_stopped; | 459 | return ide_stopped; |
| 453 | } else if ((err & BAD_CRC) == BAD_CRC) { | 460 | } else if ((err & BAD_CRC) == BAD_CRC) { |
| 454 | /* UDMA crc error, just retry the operation */ | 461 | /* UDMA crc error, just retry the operation */ |
| @@ -500,7 +507,8 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u | |||
| 500 | 507 | ||
| 501 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 508 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) |
| 502 | /* force an abort */ | 509 | /* force an abort */ |
| 503 | hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG); | 510 | hwif->OUTB(WIN_IDLEIMMEDIATE, |
| 511 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 504 | 512 | ||
| 505 | if (rq->errors >= ERROR_MAX) { | 513 | if (rq->errors >= ERROR_MAX) { |
| 506 | ide_kill_rq(drive, rq); | 514 | ide_kill_rq(drive, rq); |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index e77cee0e5d65..45944219eea0 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
| @@ -158,9 +158,12 @@ EXPORT_SYMBOL(default_hwif_mmiops); | |||
| 158 | 158 | ||
| 159 | void SELECT_DRIVE (ide_drive_t *drive) | 159 | void SELECT_DRIVE (ide_drive_t *drive) |
| 160 | { | 160 | { |
| 161 | if (HWIF(drive)->selectproc) | 161 | ide_hwif_t *hwif = drive->hwif; |
| 162 | HWIF(drive)->selectproc(drive); | 162 | |
| 163 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); | 163 | if (hwif->selectproc) |
| 164 | hwif->selectproc(drive); | ||
| 165 | |||
| 166 | hwif->OUTB(drive->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); | ||
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | void SELECT_MASK (ide_drive_t *drive, int mask) | 169 | void SELECT_MASK (ide_drive_t *drive, int mask) |
| @@ -194,15 +197,18 @@ static void ata_input_data(ide_drive_t *drive, void *buffer, u32 wcount) | |||
| 194 | if (io_32bit) { | 197 | if (io_32bit) { |
| 195 | if (io_32bit & 2) { | 198 | if (io_32bit & 2) { |
| 196 | unsigned long flags; | 199 | unsigned long flags; |
| 200 | |||
| 197 | local_irq_save(flags); | 201 | local_irq_save(flags); |
| 198 | ata_vlb_sync(drive, IDE_NSECTOR_REG); | 202 | ata_vlb_sync(drive, hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 199 | hwif->INSL(IDE_DATA_REG, buffer, wcount); | 203 | hwif->INSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 204 | wcount); | ||
| 200 | local_irq_restore(flags); | 205 | local_irq_restore(flags); |
| 201 | } else | 206 | } else |
| 202 | hwif->INSL(IDE_DATA_REG, buffer, wcount); | 207 | hwif->INSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 203 | } else { | 208 | wcount); |
| 204 | hwif->INSW(IDE_DATA_REG, buffer, wcount<<1); | 209 | } else |
| 205 | } | 210 | hwif->INSW(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 211 | wcount << 1); | ||
| 206 | } | 212 | } |
| 207 | 213 | ||
| 208 | /* | 214 | /* |
| @@ -216,15 +222,18 @@ static void ata_output_data(ide_drive_t *drive, void *buffer, u32 wcount) | |||
| 216 | if (io_32bit) { | 222 | if (io_32bit) { |
| 217 | if (io_32bit & 2) { | 223 | if (io_32bit & 2) { |
| 218 | unsigned long flags; | 224 | unsigned long flags; |
| 225 | |||
| 219 | local_irq_save(flags); | 226 | local_irq_save(flags); |
| 220 | ata_vlb_sync(drive, IDE_NSECTOR_REG); | 227 | ata_vlb_sync(drive, hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 221 | hwif->OUTSL(IDE_DATA_REG, buffer, wcount); | 228 | hwif->OUTSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 229 | wcount); | ||
| 222 | local_irq_restore(flags); | 230 | local_irq_restore(flags); |
| 223 | } else | 231 | } else |
| 224 | hwif->OUTSL(IDE_DATA_REG, buffer, wcount); | 232 | hwif->OUTSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 225 | } else { | 233 | wcount); |
| 226 | hwif->OUTSW(IDE_DATA_REG, buffer, wcount<<1); | 234 | } else |
| 227 | } | 235 | hwif->OUTSW(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 236 | wcount << 1); | ||
| 228 | } | 237 | } |
| 229 | 238 | ||
| 230 | /* | 239 | /* |
| @@ -243,13 +252,15 @@ static void atapi_input_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) | |||
| 243 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) | 252 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) |
| 244 | if (MACH_IS_ATARI || MACH_IS_Q40) { | 253 | if (MACH_IS_ATARI || MACH_IS_Q40) { |
| 245 | /* Atari has a byte-swapped IDE interface */ | 254 | /* Atari has a byte-swapped IDE interface */ |
| 246 | insw_swapw(IDE_DATA_REG, buffer, bytecount / 2); | 255 | insw_swapw(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 256 | bytecount / 2); | ||
| 247 | return; | 257 | return; |
| 248 | } | 258 | } |
| 249 | #endif /* CONFIG_ATARI || CONFIG_Q40 */ | 259 | #endif /* CONFIG_ATARI || CONFIG_Q40 */ |
| 250 | hwif->ata_input_data(drive, buffer, bytecount / 4); | 260 | hwif->ata_input_data(drive, buffer, bytecount / 4); |
| 251 | if ((bytecount & 0x03) >= 2) | 261 | if ((bytecount & 0x03) >= 2) |
| 252 | hwif->INSW(IDE_DATA_REG, ((u8 *)buffer)+(bytecount & ~0x03), 1); | 262 | hwif->INSW(hwif->io_ports[IDE_DATA_OFFSET], |
| 263 | (u8 *)buffer + (bytecount & ~0x03), 1); | ||
| 253 | } | 264 | } |
| 254 | 265 | ||
| 255 | static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) | 266 | static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) |
| @@ -260,13 +271,15 @@ static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount) | |||
| 260 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) | 271 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) |
| 261 | if (MACH_IS_ATARI || MACH_IS_Q40) { | 272 | if (MACH_IS_ATARI || MACH_IS_Q40) { |
| 262 | /* Atari has a byte-swapped IDE interface */ | 273 | /* Atari has a byte-swapped IDE interface */ |
| 263 | outsw_swapw(IDE_DATA_REG, buffer, bytecount / 2); | 274 | outsw_swapw(hwif->io_ports[IDE_DATA_OFFSET], buffer, |
| 275 | bytecount / 2); | ||
| 264 | return; | 276 | return; |
| 265 | } | 277 | } |
| 266 | #endif /* CONFIG_ATARI || CONFIG_Q40 */ | 278 | #endif /* CONFIG_ATARI || CONFIG_Q40 */ |
| 267 | hwif->ata_output_data(drive, buffer, bytecount / 4); | 279 | hwif->ata_output_data(drive, buffer, bytecount / 4); |
| 268 | if ((bytecount & 0x03) >= 2) | 280 | if ((bytecount & 0x03) >= 2) |
| 269 | hwif->OUTSW(IDE_DATA_REG, ((u8*)buffer)+(bytecount & ~0x03), 1); | 281 | hwif->OUTSW(hwif->io_ports[IDE_DATA_OFFSET], |
| 282 | (u8 *)buffer + (bytecount & ~0x03), 1); | ||
| 270 | } | 283 | } |
| 271 | 284 | ||
| 272 | void default_hwif_transport(ide_hwif_t *hwif) | 285 | void default_hwif_transport(ide_hwif_t *hwif) |
| @@ -429,7 +442,7 @@ int drive_is_ready (ide_drive_t *drive) | |||
| 429 | * an interrupt with another pci card/device. We make no assumptions | 442 | * an interrupt with another pci card/device. We make no assumptions |
| 430 | * about possible isa-pnp and pci-pnp issues yet. | 443 | * about possible isa-pnp and pci-pnp issues yet. |
| 431 | */ | 444 | */ |
| 432 | if (IDE_CONTROL_REG) | 445 | if (hwif->io_ports[IDE_CONTROL_OFFSET]) |
| 433 | stat = ide_read_altstatus(drive); | 446 | stat = ide_read_altstatus(drive); |
| 434 | else | 447 | else |
| 435 | /* Note: this may clear a pending IRQ!! */ | 448 | /* Note: this may clear a pending IRQ!! */ |
| @@ -631,7 +644,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
| 631 | SELECT_MASK(drive, 1); | 644 | SELECT_MASK(drive, 1); |
| 632 | ide_set_irq(drive, 1); | 645 | ide_set_irq(drive, 1); |
| 633 | msleep(50); | 646 | msleep(50); |
| 634 | hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG); | 647 | hwif->OUTB(WIN_IDENTIFY, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 635 | timeout = jiffies + WAIT_WORSTCASE; | 648 | timeout = jiffies + WAIT_WORSTCASE; |
| 636 | do { | 649 | do { |
| 637 | if (time_after(jiffies, timeout)) { | 650 | if (time_after(jiffies, timeout)) { |
| @@ -718,9 +731,10 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
| 718 | SELECT_MASK(drive, 0); | 731 | SELECT_MASK(drive, 0); |
| 719 | udelay(1); | 732 | udelay(1); |
| 720 | ide_set_irq(drive, 0); | 733 | ide_set_irq(drive, 0); |
| 721 | hwif->OUTB(speed, IDE_NSECTOR_REG); | 734 | hwif->OUTB(speed, hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 722 | hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); | 735 | hwif->OUTB(SETFEATURES_XFER, hwif->io_ports[IDE_FEATURE_OFFSET]); |
| 723 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); | 736 | hwif->OUTBSYNC(drive, WIN_SETFEATURES, |
| 737 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 724 | if (drive->quirk_list == 2) | 738 | if (drive->quirk_list == 2) |
| 725 | ide_set_irq(drive, 1); | 739 | ide_set_irq(drive, 1); |
| 726 | 740 | ||
| @@ -828,7 +842,7 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
| 828 | 842 | ||
| 829 | spin_lock_irqsave(&ide_lock, flags); | 843 | spin_lock_irqsave(&ide_lock, flags); |
| 830 | __ide_set_handler(drive, handler, timeout, expiry); | 844 | __ide_set_handler(drive, handler, timeout, expiry); |
| 831 | hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); | 845 | hwif->OUTBSYNC(drive, cmd, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 832 | /* | 846 | /* |
| 833 | * Drive takes 400nS to respond, we must avoid the IRQ being | 847 | * Drive takes 400nS to respond, we must avoid the IRQ being |
| 834 | * serviced before that. | 848 | * serviced before that. |
| @@ -1009,7 +1023,8 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
| 1009 | unsigned long flags; | 1023 | unsigned long flags; |
| 1010 | ide_hwif_t *hwif; | 1024 | ide_hwif_t *hwif; |
| 1011 | ide_hwgroup_t *hwgroup; | 1025 | ide_hwgroup_t *hwgroup; |
| 1012 | 1026 | u8 ctl; | |
| 1027 | |||
| 1013 | spin_lock_irqsave(&ide_lock, flags); | 1028 | spin_lock_irqsave(&ide_lock, flags); |
| 1014 | hwif = HWIF(drive); | 1029 | hwif = HWIF(drive); |
| 1015 | hwgroup = HWGROUP(drive); | 1030 | hwgroup = HWGROUP(drive); |
| @@ -1023,7 +1038,8 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
| 1023 | pre_reset(drive); | 1038 | pre_reset(drive); |
| 1024 | SELECT_DRIVE(drive); | 1039 | SELECT_DRIVE(drive); |
| 1025 | udelay (20); | 1040 | udelay (20); |
| 1026 | hwif->OUTBSYNC(drive, WIN_SRST, IDE_COMMAND_REG); | 1041 | hwif->OUTBSYNC(drive, WIN_SRST, |
| 1042 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 1027 | ndelay(400); | 1043 | ndelay(400); |
| 1028 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1044 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
| 1029 | hwgroup->polling = 1; | 1045 | hwgroup->polling = 1; |
| @@ -1039,7 +1055,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
| 1039 | for (unit = 0; unit < MAX_DRIVES; ++unit) | 1055 | for (unit = 0; unit < MAX_DRIVES; ++unit) |
| 1040 | pre_reset(&hwif->drives[unit]); | 1056 | pre_reset(&hwif->drives[unit]); |
| 1041 | 1057 | ||
| 1042 | if (!IDE_CONTROL_REG) { | 1058 | if (hwif->io_ports[IDE_CONTROL_OFFSET] == 0) { |
| 1043 | spin_unlock_irqrestore(&ide_lock, flags); | 1059 | spin_unlock_irqrestore(&ide_lock, flags); |
| 1044 | return ide_stopped; | 1060 | return ide_stopped; |
| 1045 | } | 1061 | } |
| @@ -1054,16 +1070,14 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
| 1054 | * recover from reset very quickly, saving us the first 50ms wait time. | 1070 | * recover from reset very quickly, saving us the first 50ms wait time. |
| 1055 | */ | 1071 | */ |
| 1056 | /* set SRST and nIEN */ | 1072 | /* set SRST and nIEN */ |
| 1057 | hwif->OUTBSYNC(drive, drive->ctl|6,IDE_CONTROL_REG); | 1073 | hwif->OUTBSYNC(drive, drive->ctl|6, hwif->io_ports[IDE_CONTROL_OFFSET]); |
| 1058 | /* more than enough time */ | 1074 | /* more than enough time */ |
| 1059 | udelay(10); | 1075 | udelay(10); |
| 1060 | if (drive->quirk_list == 2) { | 1076 | if (drive->quirk_list == 2) |
| 1061 | /* clear SRST and nIEN */ | 1077 | ctl = drive->ctl; /* clear SRST and nIEN */ |
| 1062 | hwif->OUTBSYNC(drive, drive->ctl, IDE_CONTROL_REG); | 1078 | else |
| 1063 | } else { | 1079 | ctl = drive->ctl | 2; /* clear SRST, leave nIEN */ |
| 1064 | /* clear SRST, leave nIEN */ | 1080 | hwif->OUTBSYNC(drive, ctl, hwif->io_ports[IDE_CONTROL_OFFSET]); |
| 1065 | hwif->OUTBSYNC(drive, drive->ctl|2, IDE_CONTROL_REG); | ||
| 1066 | } | ||
| 1067 | /* more than enough time */ | 1081 | /* more than enough time */ |
| 1068 | udelay(10); | 1082 | udelay(10); |
| 1069 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1083 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index c14bb5380c25..34c2ad36ce54 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c | |||
| @@ -62,7 +62,7 @@ static void idepnp_remove(struct pnp_dev * dev) | |||
| 62 | ide_hwif_t *hwif = pnp_get_drvdata(dev); | 62 | ide_hwif_t *hwif = pnp_get_drvdata(dev); |
| 63 | 63 | ||
| 64 | if (hwif) | 64 | if (hwif) |
| 65 | ide_unregister(hwif->index, 0, 0); | 65 | ide_unregister(hwif->index); |
| 66 | else | 66 | else |
| 67 | printk(KERN_ERR "idepnp: Unable to remove device, please report.\n"); | 67 | printk(KERN_ERR "idepnp: Unable to remove device, please report.\n"); |
| 68 | } | 68 | } |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 47a114927c31..6a196c27b0aa 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -271,7 +271,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) | |||
| 271 | /* take a deep breath */ | 271 | /* take a deep breath */ |
| 272 | msleep(50); | 272 | msleep(50); |
| 273 | 273 | ||
| 274 | if (IDE_CONTROL_REG) { | 274 | if (hwif->io_ports[IDE_CONTROL_OFFSET]) { |
| 275 | a = ide_read_altstatus(drive); | 275 | a = ide_read_altstatus(drive); |
| 276 | s = ide_read_status(drive); | 276 | s = ide_read_status(drive); |
| 277 | if ((a ^ s) & ~INDEX_STAT) | 277 | if ((a ^ s) & ~INDEX_STAT) |
| @@ -289,10 +289,10 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) | |||
| 289 | */ | 289 | */ |
| 290 | if ((cmd == WIN_PIDENTIFY)) | 290 | if ((cmd == WIN_PIDENTIFY)) |
| 291 | /* disable dma & overlap */ | 291 | /* disable dma & overlap */ |
| 292 | hwif->OUTB(0, IDE_FEATURE_REG); | 292 | hwif->OUTB(0, hwif->io_ports[IDE_FEATURE_OFFSET]); |
| 293 | 293 | ||
| 294 | /* ask drive for ID */ | 294 | /* ask drive for ID */ |
| 295 | hwif->OUTB(cmd, IDE_COMMAND_REG); | 295 | hwif->OUTB(cmd, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 296 | 296 | ||
| 297 | timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2; | 297 | timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2; |
| 298 | timeout += jiffies; | 298 | timeout += jiffies; |
| @@ -353,7 +353,7 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd) | |||
| 353 | * interrupts during the identify-phase that | 353 | * interrupts during the identify-phase that |
| 354 | * the irq handler isn't expecting. | 354 | * the irq handler isn't expecting. |
| 355 | */ | 355 | */ |
| 356 | if (IDE_CONTROL_REG) { | 356 | if (hwif->io_ports[IDE_CONTROL_OFFSET]) { |
| 357 | if (!hwif->irq) { | 357 | if (!hwif->irq) { |
| 358 | autoprobe = 1; | 358 | autoprobe = 1; |
| 359 | cookie = probe_irq_on(); | 359 | cookie = probe_irq_on(); |
| @@ -445,7 +445,8 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
| 445 | msleep(50); | 445 | msleep(50); |
| 446 | SELECT_DRIVE(drive); | 446 | SELECT_DRIVE(drive); |
| 447 | msleep(50); | 447 | msleep(50); |
| 448 | if (hwif->INB(IDE_SELECT_REG) != drive->select.all && !drive->present) { | 448 | if (hwif->INB(hwif->io_ports[IDE_SELECT_OFFSET]) != drive->select.all && |
| 449 | !drive->present) { | ||
| 449 | if (drive->select.b.unit != 0) { | 450 | if (drive->select.b.unit != 0) { |
| 450 | /* exit with drive0 selected */ | 451 | /* exit with drive0 selected */ |
| 451 | SELECT_DRIVE(&hwif->drives[0]); | 452 | SELECT_DRIVE(&hwif->drives[0]); |
| @@ -477,9 +478,11 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
| 477 | printk(KERN_ERR "%s: no response (status = 0x%02x), " | 478 | printk(KERN_ERR "%s: no response (status = 0x%02x), " |
| 478 | "resetting drive\n", drive->name, stat); | 479 | "resetting drive\n", drive->name, stat); |
| 479 | msleep(50); | 480 | msleep(50); |
| 480 | hwif->OUTB(drive->select.all, IDE_SELECT_REG); | 481 | hwif->OUTB(drive->select.all, |
| 482 | hwif->io_ports[IDE_SELECT_OFFSET]); | ||
| 481 | msleep(50); | 483 | msleep(50); |
| 482 | hwif->OUTB(WIN_SRST, IDE_COMMAND_REG); | 484 | hwif->OUTB(WIN_SRST, |
| 485 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 483 | (void)ide_busy_sleep(hwif); | 486 | (void)ide_busy_sleep(hwif); |
| 484 | rc = try_to_identify(drive, cmd); | 487 | rc = try_to_identify(drive, cmd); |
| 485 | } | 488 | } |
| @@ -515,7 +518,7 @@ static void enable_nest (ide_drive_t *drive) | |||
| 515 | printk("%s: enabling %s -- ", hwif->name, drive->id->model); | 518 | printk("%s: enabling %s -- ", hwif->name, drive->id->model); |
| 516 | SELECT_DRIVE(drive); | 519 | SELECT_DRIVE(drive); |
| 517 | msleep(50); | 520 | msleep(50); |
| 518 | hwif->OUTB(EXABYTE_ENABLE_NEST, IDE_COMMAND_REG); | 521 | hwif->OUTB(EXABYTE_ENABLE_NEST, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 519 | 522 | ||
| 520 | if (ide_busy_sleep(hwif)) { | 523 | if (ide_busy_sleep(hwif)) { |
| 521 | printk(KERN_CONT "failed (timeout)\n"); | 524 | printk(KERN_CONT "failed (timeout)\n"); |
| @@ -623,7 +626,7 @@ static void hwif_release_dev (struct device *dev) | |||
| 623 | complete(&hwif->gendev_rel_comp); | 626 | complete(&hwif->gendev_rel_comp); |
| 624 | } | 627 | } |
| 625 | 628 | ||
| 626 | static void ide_register_port(ide_hwif_t *hwif) | 629 | static int ide_register_port(ide_hwif_t *hwif) |
| 627 | { | 630 | { |
| 628 | int ret; | 631 | int ret; |
| 629 | 632 | ||
| @@ -639,9 +642,23 @@ static void ide_register_port(ide_hwif_t *hwif) | |||
| 639 | } | 642 | } |
| 640 | hwif->gendev.release = hwif_release_dev; | 643 | hwif->gendev.release = hwif_release_dev; |
| 641 | ret = device_register(&hwif->gendev); | 644 | ret = device_register(&hwif->gendev); |
| 642 | if (ret < 0) | 645 | if (ret < 0) { |
| 643 | printk(KERN_WARNING "IDE: %s: device_register error: %d\n", | 646 | printk(KERN_WARNING "IDE: %s: device_register error: %d\n", |
| 644 | __FUNCTION__, ret); | 647 | __FUNCTION__, ret); |
| 648 | goto out; | ||
| 649 | } | ||
| 650 | |||
| 651 | get_device(&hwif->gendev); | ||
| 652 | |||
| 653 | hwif->portdev = device_create(ide_port_class, &hwif->gendev, | ||
| 654 | MKDEV(0, 0), hwif->name); | ||
| 655 | if (IS_ERR(hwif->portdev)) { | ||
| 656 | ret = PTR_ERR(hwif->portdev); | ||
| 657 | device_unregister(&hwif->gendev); | ||
| 658 | } | ||
| 659 | dev_set_drvdata(hwif->portdev, hwif); | ||
| 660 | out: | ||
| 661 | return ret; | ||
| 645 | } | 662 | } |
| 646 | 663 | ||
| 647 | /** | 664 | /** |
| @@ -949,6 +966,7 @@ static void ide_port_setup_devices(ide_hwif_t *hwif) | |||
| 949 | { | 966 | { |
| 950 | int i; | 967 | int i; |
| 951 | 968 | ||
| 969 | mutex_lock(&ide_cfg_mtx); | ||
| 952 | for (i = 0; i < MAX_DRIVES; i++) { | 970 | for (i = 0; i < MAX_DRIVES; i++) { |
| 953 | ide_drive_t *drive = &hwif->drives[i]; | 971 | ide_drive_t *drive = &hwif->drives[i]; |
| 954 | 972 | ||
| @@ -963,6 +981,7 @@ static void ide_port_setup_devices(ide_hwif_t *hwif) | |||
| 963 | 981 | ||
| 964 | ide_add_drive_to_hwgroup(drive); | 982 | ide_add_drive_to_hwgroup(drive); |
| 965 | } | 983 | } |
| 984 | mutex_unlock(&ide_cfg_mtx); | ||
| 966 | } | 985 | } |
| 967 | 986 | ||
| 968 | /* | 987 | /* |
| @@ -1088,8 +1107,6 @@ static int init_irq (ide_hwif_t *hwif) | |||
| 1088 | hwif->sharing_irq ? "shar" : "serializ", match->name); | 1107 | hwif->sharing_irq ? "shar" : "serializ", match->name); |
| 1089 | printk("\n"); | 1108 | printk("\n"); |
| 1090 | 1109 | ||
| 1091 | ide_port_setup_devices(hwif); | ||
| 1092 | |||
| 1093 | mutex_unlock(&ide_cfg_mtx); | 1110 | mutex_unlock(&ide_cfg_mtx); |
| 1094 | return 0; | 1111 | return 0; |
| 1095 | out_unlink: | 1112 | out_unlink: |
| @@ -1199,6 +1216,8 @@ static void drive_release_dev (struct device *dev) | |||
| 1199 | { | 1216 | { |
| 1200 | ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); | 1217 | ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); |
| 1201 | 1218 | ||
| 1219 | ide_proc_unregister_device(drive); | ||
| 1220 | |||
| 1202 | spin_lock_irq(&ide_lock); | 1221 | spin_lock_irq(&ide_lock); |
| 1203 | ide_remove_drive_from_hwgroup(drive); | 1222 | ide_remove_drive_from_hwgroup(drive); |
| 1204 | kfree(drive->id); | 1223 | kfree(drive->id); |
| @@ -1214,6 +1233,10 @@ static void drive_release_dev (struct device *dev) | |||
| 1214 | complete(&drive->gendev_rel_comp); | 1233 | complete(&drive->gendev_rel_comp); |
| 1215 | } | 1234 | } |
| 1216 | 1235 | ||
| 1236 | #ifndef ide_default_irq | ||
| 1237 | #define ide_default_irq(irq) 0 | ||
| 1238 | #endif | ||
| 1239 | |||
| 1217 | static int hwif_init(ide_hwif_t *hwif) | 1240 | static int hwif_init(ide_hwif_t *hwif) |
| 1218 | { | 1241 | { |
| 1219 | int old_irq; | 1242 | int old_irq; |
| @@ -1225,13 +1248,6 @@ static int hwif_init(ide_hwif_t *hwif) | |||
| 1225 | return 0; | 1248 | return 0; |
| 1226 | } | 1249 | } |
| 1227 | } | 1250 | } |
| 1228 | #ifdef CONFIG_BLK_DEV_HD | ||
| 1229 | if (hwif->irq == HD_IRQ && hwif->io_ports[IDE_DATA_OFFSET] != HD_DATA) { | ||
| 1230 | printk("%s: CANNOT SHARE IRQ WITH OLD " | ||
| 1231 | "HARDDISK DRIVER (hd.c)\n", hwif->name); | ||
| 1232 | return 0; | ||
| 1233 | } | ||
| 1234 | #endif /* CONFIG_BLK_DEV_HD */ | ||
| 1235 | 1251 | ||
| 1236 | if (register_blkdev(hwif->major, hwif->name)) | 1252 | if (register_blkdev(hwif->major, hwif->name)) |
| 1237 | return 0; | 1253 | return 0; |
| @@ -1366,13 +1382,68 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
| 1366 | /* call chipset specific routine for each enabled port */ | 1382 | /* call chipset specific routine for each enabled port */ |
| 1367 | if (d->init_hwif) | 1383 | if (d->init_hwif) |
| 1368 | d->init_hwif(hwif); | 1384 | d->init_hwif(hwif); |
| 1385 | } | ||
| 1369 | 1386 | ||
| 1387 | static void ide_port_cable_detect(ide_hwif_t *hwif) | ||
| 1388 | { | ||
| 1370 | if (hwif->cable_detect && (hwif->ultra_mask & 0x78)) { | 1389 | if (hwif->cable_detect && (hwif->ultra_mask & 0x78)) { |
| 1371 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 1390 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
| 1372 | hwif->cbl = hwif->cable_detect(hwif); | 1391 | hwif->cbl = hwif->cable_detect(hwif); |
| 1373 | } | 1392 | } |
| 1374 | } | 1393 | } |
| 1375 | 1394 | ||
| 1395 | static ssize_t store_delete_devices(struct device *portdev, | ||
| 1396 | struct device_attribute *attr, | ||
| 1397 | const char *buf, size_t n) | ||
| 1398 | { | ||
| 1399 | ide_hwif_t *hwif = dev_get_drvdata(portdev); | ||
| 1400 | |||
| 1401 | if (strncmp(buf, "1", n)) | ||
| 1402 | return -EINVAL; | ||
| 1403 | |||
| 1404 | ide_port_unregister_devices(hwif); | ||
| 1405 | |||
| 1406 | return n; | ||
| 1407 | }; | ||
| 1408 | |||
| 1409 | static DEVICE_ATTR(delete_devices, S_IWUSR, NULL, store_delete_devices); | ||
| 1410 | |||
| 1411 | static ssize_t store_scan(struct device *portdev, | ||
| 1412 | struct device_attribute *attr, | ||
| 1413 | const char *buf, size_t n) | ||
| 1414 | { | ||
| 1415 | ide_hwif_t *hwif = dev_get_drvdata(portdev); | ||
| 1416 | |||
| 1417 | if (strncmp(buf, "1", n)) | ||
| 1418 | return -EINVAL; | ||
| 1419 | |||
| 1420 | ide_port_unregister_devices(hwif); | ||
| 1421 | ide_port_scan(hwif); | ||
| 1422 | |||
| 1423 | return n; | ||
| 1424 | }; | ||
| 1425 | |||
| 1426 | static DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan); | ||
| 1427 | |||
| 1428 | static struct device_attribute *ide_port_attrs[] = { | ||
| 1429 | &dev_attr_delete_devices, | ||
| 1430 | &dev_attr_scan, | ||
| 1431 | NULL | ||
| 1432 | }; | ||
| 1433 | |||
| 1434 | static int ide_sysfs_register_port(ide_hwif_t *hwif) | ||
| 1435 | { | ||
| 1436 | int i, rc; | ||
| 1437 | |||
| 1438 | for (i = 0; ide_port_attrs[i]; i++) { | ||
| 1439 | rc = device_create_file(hwif->portdev, ide_port_attrs[i]); | ||
| 1440 | if (rc) | ||
| 1441 | break; | ||
| 1442 | } | ||
| 1443 | |||
| 1444 | return rc; | ||
| 1445 | } | ||
| 1446 | |||
| 1376 | int ide_device_add_all(u8 *idx, const struct ide_port_info *d) | 1447 | int ide_device_add_all(u8 *idx, const struct ide_port_info *d) |
| 1377 | { | 1448 | { |
| 1378 | ide_hwif_t *hwif, *mate = NULL; | 1449 | ide_hwif_t *hwif, *mate = NULL; |
| @@ -1394,6 +1465,7 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d) | |||
| 1394 | mate = (i & 1) ? NULL : hwif; | 1465 | mate = (i & 1) ? NULL : hwif; |
| 1395 | 1466 | ||
| 1396 | ide_init_port(hwif, i & 1, d); | 1467 | ide_init_port(hwif, i & 1, d); |
| 1468 | ide_port_cable_detect(hwif); | ||
| 1397 | ide_port_init_devices(hwif); | 1469 | ide_port_init_devices(hwif); |
| 1398 | } | 1470 | } |
| 1399 | 1471 | ||
| @@ -1441,6 +1513,8 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d) | |||
| 1441 | continue; | 1513 | continue; |
| 1442 | } | 1514 | } |
| 1443 | 1515 | ||
| 1516 | ide_port_setup_devices(hwif); | ||
| 1517 | |||
| 1444 | ide_acpi_init(hwif); | 1518 | ide_acpi_init(hwif); |
| 1445 | ide_acpi_port_init_devices(hwif); | 1519 | ide_acpi_port_init_devices(hwif); |
| 1446 | } | 1520 | } |
| @@ -1452,8 +1526,7 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d) | |||
| 1452 | hwif = &ide_hwifs[idx[i]]; | 1526 | hwif = &ide_hwifs[idx[i]]; |
| 1453 | 1527 | ||
| 1454 | if (hwif->present) { | 1528 | if (hwif->present) { |
| 1455 | if (hwif->chipset == ide_unknown || | 1529 | if (hwif->chipset == ide_unknown) |
| 1456 | hwif->chipset == ide_forced) | ||
| 1457 | hwif->chipset = ide_generic; | 1530 | hwif->chipset = ide_generic; |
| 1458 | hwif_register_devices(hwif); | 1531 | hwif_register_devices(hwif); |
| 1459 | } | 1532 | } |
| @@ -1466,6 +1539,7 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d) | |||
| 1466 | hwif = &ide_hwifs[idx[i]]; | 1539 | hwif = &ide_hwifs[idx[i]]; |
| 1467 | 1540 | ||
| 1468 | if (hwif->present) { | 1541 | if (hwif->present) { |
| 1542 | ide_sysfs_register_port(hwif); | ||
| 1469 | ide_proc_register_port(hwif); | 1543 | ide_proc_register_port(hwif); |
| 1470 | ide_proc_port_register_devices(hwif); | 1544 | ide_proc_port_register_devices(hwif); |
| 1471 | } | 1545 | } |
| @@ -1486,3 +1560,21 @@ int ide_device_add(u8 idx[4], const struct ide_port_info *d) | |||
| 1486 | return ide_device_add_all(idx_all, d); | 1560 | return ide_device_add_all(idx_all, d); |
| 1487 | } | 1561 | } |
| 1488 | EXPORT_SYMBOL_GPL(ide_device_add); | 1562 | EXPORT_SYMBOL_GPL(ide_device_add); |
| 1563 | |||
| 1564 | void ide_port_scan(ide_hwif_t *hwif) | ||
| 1565 | { | ||
| 1566 | ide_port_cable_detect(hwif); | ||
| 1567 | ide_port_init_devices(hwif); | ||
| 1568 | |||
| 1569 | if (ide_probe_port(hwif) < 0) | ||
| 1570 | return; | ||
| 1571 | |||
| 1572 | hwif->present = 1; | ||
| 1573 | |||
| 1574 | ide_port_tune_devices(hwif); | ||
| 1575 | ide_acpi_port_init_devices(hwif); | ||
| 1576 | ide_port_setup_devices(hwif); | ||
| 1577 | hwif_register_devices(hwif); | ||
| 1578 | ide_proc_port_register_devices(hwif); | ||
| 1579 | } | ||
| 1580 | EXPORT_SYMBOL_GPL(ide_port_scan); | ||
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index bab88ca7f7ec..edd7f186dc4d 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
| @@ -46,9 +46,6 @@ static int proc_ide_read_imodel | |||
| 46 | int len; | 46 | int len; |
| 47 | const char *name; | 47 | const char *name; |
| 48 | 48 | ||
| 49 | /* | ||
| 50 | * Neither ide_unknown nor ide_forced should be set at this point. | ||
| 51 | */ | ||
| 52 | switch (hwif->chipset) { | 49 | switch (hwif->chipset) { |
| 53 | case ide_generic: name = "generic"; break; | 50 | case ide_generic: name = "generic"; break; |
| 54 | case ide_pci: name = "pci"; break; | 51 | case ide_pci: name = "pci"; break; |
| @@ -764,27 +761,16 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) | |||
| 764 | } | 761 | } |
| 765 | } | 762 | } |
| 766 | 763 | ||
| 767 | static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) | 764 | void ide_proc_unregister_device(ide_drive_t *drive) |
| 768 | { | 765 | { |
| 769 | if (drive->proc) { | 766 | if (drive->proc) { |
| 770 | ide_remove_proc_entries(drive->proc, generic_drive_entries); | 767 | ide_remove_proc_entries(drive->proc, generic_drive_entries); |
| 771 | remove_proc_entry(drive->name, proc_ide_root); | 768 | remove_proc_entry(drive->name, proc_ide_root); |
| 772 | remove_proc_entry(drive->name, hwif->proc); | 769 | remove_proc_entry(drive->name, drive->hwif->proc); |
| 773 | drive->proc = NULL; | 770 | drive->proc = NULL; |
| 774 | } | 771 | } |
| 775 | } | 772 | } |
| 776 | 773 | ||
| 777 | static void destroy_proc_ide_drives(ide_hwif_t *hwif) | ||
| 778 | { | ||
| 779 | int d; | ||
| 780 | |||
| 781 | for (d = 0; d < MAX_DRIVES; d++) { | ||
| 782 | ide_drive_t *drive = &hwif->drives[d]; | ||
| 783 | if (drive->proc) | ||
| 784 | destroy_proc_ide_device(hwif, drive); | ||
| 785 | } | ||
| 786 | } | ||
| 787 | |||
| 788 | static ide_proc_entry_t hwif_entries[] = { | 774 | static ide_proc_entry_t hwif_entries[] = { |
| 789 | { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL }, | 775 | { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL }, |
| 790 | { "mate", S_IFREG|S_IRUGO, proc_ide_read_mate, NULL }, | 776 | { "mate", S_IFREG|S_IRUGO, proc_ide_read_mate, NULL }, |
| @@ -816,7 +802,6 @@ EXPORT_SYMBOL_GPL(ide_pci_create_host_proc); | |||
| 816 | void ide_proc_unregister_port(ide_hwif_t *hwif) | 802 | void ide_proc_unregister_port(ide_hwif_t *hwif) |
| 817 | { | 803 | { |
| 818 | if (hwif->proc) { | 804 | if (hwif->proc) { |
| 819 | destroy_proc_ide_drives(hwif); | ||
| 820 | ide_remove_proc_entries(hwif->proc, hwif_entries); | 805 | ide_remove_proc_entries(hwif->proc, hwif_entries); |
| 821 | remove_proc_entry(hwif->name, proc_ide_root); | 806 | remove_proc_entry(hwif->name, proc_ide_root); |
| 822 | hwif->proc = NULL; | 807 | hwif->proc = NULL; |
diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c index 93d2e41be853..98888da1b600 100644 --- a/drivers/ide/ide-scan-pci.c +++ b/drivers/ide/ide-scan-pci.c | |||
| @@ -88,13 +88,8 @@ static int __init ide_scan_pcibus(void) | |||
| 88 | struct list_head *l, *n; | 88 | struct list_head *l, *n; |
| 89 | 89 | ||
| 90 | pre_init = 0; | 90 | pre_init = 0; |
| 91 | if (!ide_scan_direction) | 91 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev))) |
| 92 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev))) | 92 | ide_scan_pcidev(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 | 93 | ||
| 99 | /* | 94 | /* |
| 100 | * Hand the drivers over to the PCI layer now we | 95 | * Hand the drivers over to the PCI layer now we |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 0598ecfd5f37..f43fd070f1b6 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -181,49 +181,63 @@ struct idetape_bh { | |||
| 181 | char *b_data; | 181 | char *b_data; |
| 182 | }; | 182 | }; |
| 183 | 183 | ||
| 184 | typedef struct idetape_packet_command_s { | 184 | /* Tape door status */ |
| 185 | /* Actual packet bytes */ | 185 | #define DOOR_UNLOCKED 0 |
| 186 | u8 c[12]; | 186 | #define DOOR_LOCKED 1 |
| 187 | /* On each retry, we increment retries */ | 187 | #define DOOR_EXPLICITLY_LOCKED 2 |
| 188 | int retries; | 188 | |
| 189 | /* Error code */ | 189 | /* Some defines for the SPACE command */ |
| 190 | int error; | 190 | #define IDETAPE_SPACE_OVER_FILEMARK 1 |
| 191 | /* Bytes to transfer */ | 191 | #define IDETAPE_SPACE_TO_EOD 3 |
| 192 | int request_transfer; | 192 | |
| 193 | /* Bytes actually transferred */ | 193 | /* Some defines for the LOAD UNLOAD command */ |
| 194 | int actually_transferred; | 194 | #define IDETAPE_LU_LOAD_MASK 1 |
| 195 | /* Size of our data buffer */ | 195 | #define IDETAPE_LU_RETENSION_MASK 2 |
| 196 | int buffer_size; | 196 | #define IDETAPE_LU_EOT_MASK 4 |
| 197 | struct idetape_bh *bh; | ||
| 198 | char *b_data; | ||
| 199 | int b_count; | ||
| 200 | /* Data buffer */ | ||
| 201 | u8 *buffer; | ||
| 202 | /* Pointer into the above buffer */ | ||
| 203 | u8 *current_position; | ||
| 204 | /* Called when this packet command is completed */ | ||
| 205 | ide_startstop_t (*callback) (ide_drive_t *); | ||
| 206 | /* Temporary buffer */ | ||
| 207 | u8 pc_buffer[IDETAPE_PC_BUFFER_SIZE]; | ||
| 208 | /* Status/Action bit flags: long for set_bit */ | ||
| 209 | unsigned long flags; | ||
| 210 | } idetape_pc_t; | ||
| 211 | 197 | ||
| 212 | /* | 198 | /* |
| 213 | * Packet command flag bits. | 199 | * Special requests for our block device strategy routine. |
| 200 | * | ||
| 201 | * In order to service a character device command, we add special requests to | ||
| 202 | * the tail of our block device request queue and wait for their completion. | ||
| 214 | */ | 203 | */ |
| 215 | /* Set when an error is considered normal - We won't retry */ | 204 | |
| 216 | #define PC_ABORT 0 | 205 | enum { |
| 217 | /* 1 When polling for DSC on a media access command */ | 206 | REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */ |
| 218 | #define PC_WAIT_FOR_DSC 1 | 207 | REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */ |
| 219 | /* 1 when we prefer to use DMA if possible */ | 208 | REQ_IDETAPE_READ = (1 << 2), |
| 220 | #define PC_DMA_RECOMMENDED 2 | 209 | REQ_IDETAPE_WRITE = (1 << 3), |
| 221 | /* 1 while DMA in progress */ | 210 | }; |
| 222 | #define PC_DMA_IN_PROGRESS 3 | 211 | |
| 223 | /* 1 when encountered problem during DMA */ | 212 | /* Error codes returned in rq->errors to the higher part of the driver. */ |
| 224 | #define PC_DMA_ERROR 4 | 213 | #define IDETAPE_ERROR_GENERAL 101 |
| 225 | /* Data direction */ | 214 | #define IDETAPE_ERROR_FILEMARK 102 |
| 226 | #define PC_WRITING 5 | 215 | #define IDETAPE_ERROR_EOD 103 |
| 216 | |||
| 217 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ | ||
| 218 | #define IDETAPE_BLOCK_DESCRIPTOR 0 | ||
| 219 | #define IDETAPE_CAPABILITIES_PAGE 0x2a | ||
| 220 | |||
| 221 | /* Tape flag bits values. */ | ||
| 222 | enum { | ||
| 223 | IDETAPE_FLAG_IGNORE_DSC = (1 << 0), | ||
| 224 | /* 0 When the tape position is unknown */ | ||
| 225 | IDETAPE_FLAG_ADDRESS_VALID = (1 << 1), | ||
| 226 | /* Device already opened */ | ||
| 227 | IDETAPE_FLAG_BUSY = (1 << 2), | ||
| 228 | /* Error detected in a pipeline stage */ | ||
| 229 | IDETAPE_FLAG_PIPELINE_ERR = (1 << 3), | ||
| 230 | /* Attempt to auto-detect the current user block size */ | ||
| 231 | IDETAPE_FLAG_DETECT_BS = (1 << 4), | ||
| 232 | /* Currently on a filemark */ | ||
| 233 | IDETAPE_FLAG_FILEMARK = (1 << 5), | ||
| 234 | /* DRQ interrupt device */ | ||
| 235 | IDETAPE_FLAG_DRQ_INTERRUPT = (1 << 6), | ||
| 236 | /* pipeline active */ | ||
| 237 | IDETAPE_FLAG_PIPELINE_ACTIVE = (1 << 7), | ||
| 238 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | ||
| 239 | IDETAPE_FLAG_MEDIUM_PRESENT = (1 << 8), | ||
| 240 | }; | ||
| 227 | 241 | ||
| 228 | /* A pipeline stage. */ | 242 | /* A pipeline stage. */ |
| 229 | typedef struct idetape_stage_s { | 243 | typedef struct idetape_stage_s { |
| @@ -258,11 +272,11 @@ typedef struct ide_tape_obj { | |||
| 258 | * retry, to get detailed information on what went wrong. | 272 | * retry, to get detailed information on what went wrong. |
| 259 | */ | 273 | */ |
| 260 | /* Current packet command */ | 274 | /* Current packet command */ |
| 261 | idetape_pc_t *pc; | 275 | struct ide_atapi_pc *pc; |
| 262 | /* Last failed packet command */ | 276 | /* Last failed packet command */ |
| 263 | idetape_pc_t *failed_pc; | 277 | struct ide_atapi_pc *failed_pc; |
| 264 | /* Packet command stack */ | 278 | /* Packet command stack */ |
| 265 | idetape_pc_t pc_stack[IDETAPE_PC_STACK]; | 279 | struct ide_atapi_pc pc_stack[IDETAPE_PC_STACK]; |
| 266 | /* Next free packet command storage space */ | 280 | /* Next free packet command storage space */ |
| 267 | int pc_stack_index; | 281 | int pc_stack_index; |
| 268 | struct request rq_stack[IDETAPE_PC_STACK]; | 282 | struct request rq_stack[IDETAPE_PC_STACK]; |
| @@ -446,58 +460,6 @@ static void ide_tape_put(struct ide_tape_obj *tape) | |||
| 446 | mutex_unlock(&idetape_ref_mutex); | 460 | mutex_unlock(&idetape_ref_mutex); |
| 447 | } | 461 | } |
| 448 | 462 | ||
| 449 | /* Tape door status */ | ||
| 450 | #define DOOR_UNLOCKED 0 | ||
| 451 | #define DOOR_LOCKED 1 | ||
| 452 | #define DOOR_EXPLICITLY_LOCKED 2 | ||
| 453 | |||
| 454 | /* | ||
| 455 | * Tape flag bits values. | ||
| 456 | */ | ||
| 457 | #define IDETAPE_IGNORE_DSC 0 | ||
| 458 | #define IDETAPE_ADDRESS_VALID 1 /* 0 When the tape position is unknown */ | ||
| 459 | #define IDETAPE_BUSY 2 /* Device already opened */ | ||
| 460 | #define IDETAPE_PIPELINE_ERROR 3 /* Error detected in a pipeline stage */ | ||
| 461 | #define IDETAPE_DETECT_BS 4 /* Attempt to auto-detect the current user block size */ | ||
| 462 | #define IDETAPE_FILEMARK 5 /* Currently on a filemark */ | ||
| 463 | #define IDETAPE_DRQ_INTERRUPT 6 /* DRQ interrupt device */ | ||
| 464 | #define IDETAPE_READ_ERROR 7 | ||
| 465 | #define IDETAPE_PIPELINE_ACTIVE 8 /* pipeline active */ | ||
| 466 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | ||
| 467 | #define IDETAPE_MEDIUM_PRESENT 9 | ||
| 468 | |||
| 469 | /* Some defines for the SPACE command */ | ||
| 470 | #define IDETAPE_SPACE_OVER_FILEMARK 1 | ||
| 471 | #define IDETAPE_SPACE_TO_EOD 3 | ||
| 472 | |||
| 473 | /* Some defines for the LOAD UNLOAD command */ | ||
| 474 | #define IDETAPE_LU_LOAD_MASK 1 | ||
| 475 | #define IDETAPE_LU_RETENSION_MASK 2 | ||
| 476 | #define IDETAPE_LU_EOT_MASK 4 | ||
| 477 | |||
| 478 | /* | ||
| 479 | * Special requests for our block device strategy routine. | ||
| 480 | * | ||
| 481 | * In order to service a character device command, we add special requests to | ||
| 482 | * the tail of our block device request queue and wait for their completion. | ||
| 483 | */ | ||
| 484 | |||
| 485 | enum { | ||
| 486 | REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */ | ||
| 487 | REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */ | ||
| 488 | REQ_IDETAPE_READ = (1 << 2), | ||
| 489 | REQ_IDETAPE_WRITE = (1 << 3), | ||
| 490 | }; | ||
| 491 | |||
| 492 | /* Error codes returned in rq->errors to the higher part of the driver. */ | ||
| 493 | #define IDETAPE_ERROR_GENERAL 101 | ||
| 494 | #define IDETAPE_ERROR_FILEMARK 102 | ||
| 495 | #define IDETAPE_ERROR_EOD 103 | ||
| 496 | |||
| 497 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ | ||
| 498 | #define IDETAPE_BLOCK_DESCRIPTOR 0 | ||
| 499 | #define IDETAPE_CAPABILITIES_PAGE 0x2a | ||
| 500 | |||
| 501 | /* | 463 | /* |
| 502 | * The variables below are used for the character device interface. Additional | 464 | * The variables below are used for the character device interface. Additional |
| 503 | * state variables are defined in our ide_drive_t structure. | 465 | * state variables are defined in our ide_drive_t structure. |
| @@ -518,17 +480,7 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i) | |||
| 518 | return tape; | 480 | return tape; |
| 519 | } | 481 | } |
| 520 | 482 | ||
| 521 | /* | 483 | static void idetape_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 522 | * Too bad. The drive wants to send us data which we are not ready to accept. | ||
| 523 | * Just throw it away. | ||
| 524 | */ | ||
| 525 | static void idetape_discard_data(ide_drive_t *drive, unsigned int bcount) | ||
| 526 | { | ||
| 527 | while (bcount--) | ||
| 528 | (void) HWIF(drive)->INB(IDE_DATA_REG); | ||
| 529 | } | ||
| 530 | |||
| 531 | static void idetape_input_buffers(ide_drive_t *drive, idetape_pc_t *pc, | ||
| 532 | unsigned int bcount) | 484 | unsigned int bcount) |
| 533 | { | 485 | { |
| 534 | struct idetape_bh *bh = pc->bh; | 486 | struct idetape_bh *bh = pc->bh; |
| @@ -538,7 +490,7 @@ static void idetape_input_buffers(ide_drive_t *drive, idetape_pc_t *pc, | |||
| 538 | if (bh == NULL) { | 490 | if (bh == NULL) { |
| 539 | printk(KERN_ERR "ide-tape: bh == NULL in " | 491 | printk(KERN_ERR "ide-tape: bh == NULL in " |
| 540 | "idetape_input_buffers\n"); | 492 | "idetape_input_buffers\n"); |
| 541 | idetape_discard_data(drive, bcount); | 493 | ide_atapi_discard_data(drive, bcount); |
| 542 | return; | 494 | return; |
| 543 | } | 495 | } |
| 544 | count = min( | 496 | count = min( |
| @@ -557,7 +509,7 @@ static void idetape_input_buffers(ide_drive_t *drive, idetape_pc_t *pc, | |||
| 557 | pc->bh = bh; | 509 | pc->bh = bh; |
| 558 | } | 510 | } |
| 559 | 511 | ||
| 560 | static void idetape_output_buffers(ide_drive_t *drive, idetape_pc_t *pc, | 512 | static void idetape_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 561 | unsigned int bcount) | 513 | unsigned int bcount) |
| 562 | { | 514 | { |
| 563 | struct idetape_bh *bh = pc->bh; | 515 | struct idetape_bh *bh = pc->bh; |
| @@ -585,13 +537,13 @@ static void idetape_output_buffers(ide_drive_t *drive, idetape_pc_t *pc, | |||
| 585 | } | 537 | } |
| 586 | } | 538 | } |
| 587 | 539 | ||
| 588 | static void idetape_update_buffers(idetape_pc_t *pc) | 540 | static void idetape_update_buffers(struct ide_atapi_pc *pc) |
| 589 | { | 541 | { |
| 590 | struct idetape_bh *bh = pc->bh; | 542 | struct idetape_bh *bh = pc->bh; |
| 591 | int count; | 543 | int count; |
| 592 | unsigned int bcount = pc->actually_transferred; | 544 | unsigned int bcount = pc->xferred; |
| 593 | 545 | ||
| 594 | if (test_bit(PC_WRITING, &pc->flags)) | 546 | if (pc->flags & PC_FLAG_WRITING) |
| 595 | return; | 547 | return; |
| 596 | while (bcount) { | 548 | while (bcount) { |
| 597 | if (bh == NULL) { | 549 | if (bh == NULL) { |
| @@ -614,7 +566,7 @@ static void idetape_update_buffers(idetape_pc_t *pc) | |||
| 614 | * driver. A storage space for a maximum of IDETAPE_PC_STACK packet | 566 | * driver. A storage space for a maximum of IDETAPE_PC_STACK packet |
| 615 | * commands is allocated at initialization time. | 567 | * commands is allocated at initialization time. |
| 616 | */ | 568 | */ |
| 617 | static idetape_pc_t *idetape_next_pc_storage(ide_drive_t *drive) | 569 | static struct ide_atapi_pc *idetape_next_pc_storage(ide_drive_t *drive) |
| 618 | { | 570 | { |
| 619 | idetape_tape_t *tape = drive->driver_data; | 571 | idetape_tape_t *tape = drive->driver_data; |
| 620 | 572 | ||
| @@ -649,14 +601,14 @@ static struct request *idetape_next_rq_storage(ide_drive_t *drive) | |||
| 649 | return (&tape->rq_stack[tape->rq_stack_index++]); | 601 | return (&tape->rq_stack[tape->rq_stack_index++]); |
| 650 | } | 602 | } |
| 651 | 603 | ||
| 652 | static void idetape_init_pc(idetape_pc_t *pc) | 604 | static void idetape_init_pc(struct ide_atapi_pc *pc) |
| 653 | { | 605 | { |
| 654 | memset(pc->c, 0, 12); | 606 | memset(pc->c, 0, 12); |
| 655 | pc->retries = 0; | 607 | pc->retries = 0; |
| 656 | pc->flags = 0; | 608 | pc->flags = 0; |
| 657 | pc->request_transfer = 0; | 609 | pc->req_xfer = 0; |
| 658 | pc->buffer = pc->pc_buffer; | 610 | pc->buf = pc->pc_buf; |
| 659 | pc->buffer_size = IDETAPE_PC_BUFFER_SIZE; | 611 | pc->buf_size = IDETAPE_PC_BUFFER_SIZE; |
| 660 | pc->bh = NULL; | 612 | pc->bh = NULL; |
| 661 | pc->b_data = NULL; | 613 | pc->b_data = NULL; |
| 662 | } | 614 | } |
| @@ -668,7 +620,7 @@ static void idetape_init_pc(idetape_pc_t *pc) | |||
| 668 | static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) | 620 | static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) |
| 669 | { | 621 | { |
| 670 | idetape_tape_t *tape = drive->driver_data; | 622 | idetape_tape_t *tape = drive->driver_data; |
| 671 | idetape_pc_t *pc = tape->failed_pc; | 623 | struct ide_atapi_pc *pc = tape->failed_pc; |
| 672 | 624 | ||
| 673 | tape->sense_key = sense[2] & 0xF; | 625 | tape->sense_key = sense[2] & 0xF; |
| 674 | tape->asc = sense[12]; | 626 | tape->asc = sense[12]; |
| @@ -677,9 +629,9 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) | |||
| 677 | debug_log(DBG_ERR, "pc = %x, sense key = %x, asc = %x, ascq = %x\n", | 629 | debug_log(DBG_ERR, "pc = %x, sense key = %x, asc = %x, ascq = %x\n", |
| 678 | pc->c[0], tape->sense_key, tape->asc, tape->ascq); | 630 | pc->c[0], tape->sense_key, tape->asc, tape->ascq); |
| 679 | 631 | ||
| 680 | /* Correct pc->actually_transferred by asking the tape. */ | 632 | /* Correct pc->xferred by asking the tape. */ |
| 681 | if (test_bit(PC_DMA_ERROR, &pc->flags)) { | 633 | if (pc->flags & PC_FLAG_DMA_ERROR) { |
| 682 | pc->actually_transferred = pc->request_transfer - | 634 | pc->xferred = pc->req_xfer - |
| 683 | tape->blk_size * | 635 | tape->blk_size * |
| 684 | be32_to_cpu(get_unaligned((u32 *)&sense[3])); | 636 | be32_to_cpu(get_unaligned((u32 *)&sense[3])); |
| 685 | idetape_update_buffers(pc); | 637 | idetape_update_buffers(pc); |
| @@ -697,27 +649,27 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) | |||
| 697 | /* don't report an error, everything's ok */ | 649 | /* don't report an error, everything's ok */ |
| 698 | pc->error = 0; | 650 | pc->error = 0; |
| 699 | /* don't retry read/write */ | 651 | /* don't retry read/write */ |
| 700 | set_bit(PC_ABORT, &pc->flags); | 652 | pc->flags |= PC_FLAG_ABORT; |
| 701 | } | 653 | } |
| 702 | } | 654 | } |
| 703 | if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { | 655 | if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { |
| 704 | pc->error = IDETAPE_ERROR_FILEMARK; | 656 | pc->error = IDETAPE_ERROR_FILEMARK; |
| 705 | set_bit(PC_ABORT, &pc->flags); | 657 | pc->flags |= PC_FLAG_ABORT; |
| 706 | } | 658 | } |
| 707 | if (pc->c[0] == WRITE_6) { | 659 | if (pc->c[0] == WRITE_6) { |
| 708 | if ((sense[2] & 0x40) || (tape->sense_key == 0xd | 660 | if ((sense[2] & 0x40) || (tape->sense_key == 0xd |
| 709 | && tape->asc == 0x0 && tape->ascq == 0x2)) { | 661 | && tape->asc == 0x0 && tape->ascq == 0x2)) { |
| 710 | pc->error = IDETAPE_ERROR_EOD; | 662 | pc->error = IDETAPE_ERROR_EOD; |
| 711 | set_bit(PC_ABORT, &pc->flags); | 663 | pc->flags |= PC_FLAG_ABORT; |
| 712 | } | 664 | } |
| 713 | } | 665 | } |
| 714 | if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { | 666 | if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { |
| 715 | if (tape->sense_key == 8) { | 667 | if (tape->sense_key == 8) { |
| 716 | pc->error = IDETAPE_ERROR_EOD; | 668 | pc->error = IDETAPE_ERROR_EOD; |
| 717 | set_bit(PC_ABORT, &pc->flags); | 669 | pc->flags |= PC_FLAG_ABORT; |
| 718 | } | 670 | } |
| 719 | if (!test_bit(PC_ABORT, &pc->flags) && | 671 | if (!(pc->flags & PC_FLAG_ABORT) && |
| 720 | pc->actually_transferred) | 672 | pc->xferred) |
| 721 | pc->retries = IDETAPE_MAX_PC_RETRIES + 1; | 673 | pc->retries = IDETAPE_MAX_PC_RETRIES + 1; |
| 722 | } | 674 | } |
| 723 | } | 675 | } |
| @@ -872,14 +824,16 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) | |||
| 872 | if (rq->cmd[0] & REQ_IDETAPE_WRITE) { | 824 | if (rq->cmd[0] & REQ_IDETAPE_WRITE) { |
| 873 | remove_stage = 1; | 825 | remove_stage = 1; |
| 874 | if (error) { | 826 | if (error) { |
| 875 | set_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | 827 | set_bit(IDETAPE_FLAG_PIPELINE_ERR, |
| 828 | &tape->flags); | ||
| 876 | if (error == IDETAPE_ERROR_EOD) | 829 | if (error == IDETAPE_ERROR_EOD) |
| 877 | idetape_abort_pipeline(drive, | 830 | idetape_abort_pipeline(drive, |
| 878 | active_stage); | 831 | active_stage); |
| 879 | } | 832 | } |
| 880 | } else if (rq->cmd[0] & REQ_IDETAPE_READ) { | 833 | } else if (rq->cmd[0] & REQ_IDETAPE_READ) { |
| 881 | if (error == IDETAPE_ERROR_EOD) { | 834 | if (error == IDETAPE_ERROR_EOD) { |
| 882 | set_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | 835 | set_bit(IDETAPE_FLAG_PIPELINE_ERR, |
| 836 | &tape->flags); | ||
| 883 | idetape_abort_pipeline(drive, active_stage); | 837 | idetape_abort_pipeline(drive, active_stage); |
| 884 | } | 838 | } |
| 885 | } | 839 | } |
| @@ -912,7 +866,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) | |||
| 912 | if (remove_stage) | 866 | if (remove_stage) |
| 913 | idetape_remove_stage_head(drive); | 867 | idetape_remove_stage_head(drive); |
| 914 | if (tape->active_data_rq == NULL) | 868 | if (tape->active_data_rq == NULL) |
| 915 | clear_bit(IDETAPE_PIPELINE_ACTIVE, &tape->flags); | 869 | clear_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags); |
| 916 | spin_unlock_irqrestore(&tape->lock, flags); | 870 | spin_unlock_irqrestore(&tape->lock, flags); |
| 917 | return 0; | 871 | return 0; |
| 918 | } | 872 | } |
| @@ -924,7 +878,7 @@ static ide_startstop_t idetape_request_sense_callback(ide_drive_t *drive) | |||
| 924 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | 878 | debug_log(DBG_PROCS, "Enter %s\n", __func__); |
| 925 | 879 | ||
| 926 | if (!tape->pc->error) { | 880 | if (!tape->pc->error) { |
| 927 | idetape_analyze_error(drive, tape->pc->buffer); | 881 | idetape_analyze_error(drive, tape->pc->buf); |
| 928 | idetape_end_request(drive, 1, 0); | 882 | idetape_end_request(drive, 1, 0); |
| 929 | } else { | 883 | } else { |
| 930 | printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - " | 884 | printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - " |
| @@ -934,13 +888,13 @@ static ide_startstop_t idetape_request_sense_callback(ide_drive_t *drive) | |||
| 934 | return ide_stopped; | 888 | return ide_stopped; |
| 935 | } | 889 | } |
| 936 | 890 | ||
| 937 | static void idetape_create_request_sense_cmd(idetape_pc_t *pc) | 891 | static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc) |
| 938 | { | 892 | { |
| 939 | idetape_init_pc(pc); | 893 | idetape_init_pc(pc); |
| 940 | pc->c[0] = REQUEST_SENSE; | 894 | pc->c[0] = REQUEST_SENSE; |
| 941 | pc->c[4] = 20; | 895 | pc->c[4] = 20; |
| 942 | pc->request_transfer = 20; | 896 | pc->req_xfer = 20; |
| 943 | pc->callback = &idetape_request_sense_callback; | 897 | pc->idetape_callback = &idetape_request_sense_callback; |
| 944 | } | 898 | } |
| 945 | 899 | ||
| 946 | static void idetape_init_rq(struct request *rq, u8 cmd) | 900 | static void idetape_init_rq(struct request *rq, u8 cmd) |
| @@ -965,7 +919,7 @@ static void idetape_init_rq(struct request *rq, u8 cmd) | |||
| 965 | * handling functions should queue request to the lower level part and wait for | 919 | * handling functions should queue request to the lower level part and wait for |
| 966 | * their completion using idetape_queue_pc_tail or idetape_queue_rw_tail. | 920 | * their completion using idetape_queue_pc_tail or idetape_queue_rw_tail. |
| 967 | */ | 921 | */ |
| 968 | static void idetape_queue_pc_head(ide_drive_t *drive, idetape_pc_t *pc, | 922 | static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 969 | struct request *rq) | 923 | struct request *rq) |
| 970 | { | 924 | { |
| 971 | struct ide_tape_obj *tape = drive->driver_data; | 925 | struct ide_tape_obj *tape = drive->driver_data; |
| @@ -984,14 +938,14 @@ static void idetape_queue_pc_head(ide_drive_t *drive, idetape_pc_t *pc, | |||
| 984 | static ide_startstop_t idetape_retry_pc (ide_drive_t *drive) | 938 | static ide_startstop_t idetape_retry_pc (ide_drive_t *drive) |
| 985 | { | 939 | { |
| 986 | idetape_tape_t *tape = drive->driver_data; | 940 | idetape_tape_t *tape = drive->driver_data; |
| 987 | idetape_pc_t *pc; | 941 | struct ide_atapi_pc *pc; |
| 988 | struct request *rq; | 942 | struct request *rq; |
| 989 | 943 | ||
| 990 | (void)ide_read_error(drive); | 944 | (void)ide_read_error(drive); |
| 991 | pc = idetape_next_pc_storage(drive); | 945 | pc = idetape_next_pc_storage(drive); |
| 992 | rq = idetape_next_rq_storage(drive); | 946 | rq = idetape_next_rq_storage(drive); |
| 993 | idetape_create_request_sense_cmd(pc); | 947 | idetape_create_request_sense_cmd(pc); |
| 994 | set_bit(IDETAPE_IGNORE_DSC, &tape->flags); | 948 | set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags); |
| 995 | idetape_queue_pc_head(drive, pc, rq); | 949 | idetape_queue_pc_head(drive, pc, rq); |
| 996 | return ide_stopped; | 950 | return ide_stopped; |
| 997 | } | 951 | } |
| @@ -1010,7 +964,7 @@ static void idetape_postpone_request(ide_drive_t *drive) | |||
| 1010 | ide_stall_queue(drive, tape->dsc_poll_freq); | 964 | ide_stall_queue(drive, tape->dsc_poll_freq); |
| 1011 | } | 965 | } |
| 1012 | 966 | ||
| 1013 | typedef void idetape_io_buf(ide_drive_t *, idetape_pc_t *, unsigned int); | 967 | typedef void idetape_io_buf(ide_drive_t *, struct ide_atapi_pc *, unsigned int); |
| 1014 | 968 | ||
| 1015 | /* | 969 | /* |
| 1016 | * This is the usual interrupt handler which will be called during a packet | 970 | * This is the usual interrupt handler which will be called during a packet |
| @@ -1023,7 +977,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1023 | { | 977 | { |
| 1024 | ide_hwif_t *hwif = drive->hwif; | 978 | ide_hwif_t *hwif = drive->hwif; |
| 1025 | idetape_tape_t *tape = drive->driver_data; | 979 | idetape_tape_t *tape = drive->driver_data; |
| 1026 | idetape_pc_t *pc = tape->pc; | 980 | struct ide_atapi_pc *pc = tape->pc; |
| 1027 | xfer_func_t *xferfunc; | 981 | xfer_func_t *xferfunc; |
| 1028 | idetape_io_buf *iobuf; | 982 | idetape_io_buf *iobuf; |
| 1029 | unsigned int temp; | 983 | unsigned int temp; |
| @@ -1038,7 +992,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1038 | /* Clear the interrupt */ | 992 | /* Clear the interrupt */ |
| 1039 | stat = ide_read_status(drive); | 993 | stat = ide_read_status(drive); |
| 1040 | 994 | ||
| 1041 | if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) { | 995 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { |
| 1042 | if (hwif->ide_dma_end(drive) || (stat & ERR_STAT)) { | 996 | if (hwif->ide_dma_end(drive) || (stat & ERR_STAT)) { |
| 1043 | /* | 997 | /* |
| 1044 | * A DMA error is sometimes expected. For example, | 998 | * A DMA error is sometimes expected. For example, |
| @@ -1061,9 +1015,9 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1061 | * data transfer will occur, but no DMA error. | 1015 | * data transfer will occur, but no DMA error. |
| 1062 | * (AS, 19 Apr 2001) | 1016 | * (AS, 19 Apr 2001) |
| 1063 | */ | 1017 | */ |
| 1064 | set_bit(PC_DMA_ERROR, &pc->flags); | 1018 | pc->flags |= PC_FLAG_DMA_ERROR; |
| 1065 | } else { | 1019 | } else { |
| 1066 | pc->actually_transferred = pc->request_transfer; | 1020 | pc->xferred = pc->req_xfer; |
| 1067 | idetape_update_buffers(pc); | 1021 | idetape_update_buffers(pc); |
| 1068 | } | 1022 | } |
| 1069 | debug_log(DBG_PROCS, "DMA finished\n"); | 1023 | debug_log(DBG_PROCS, "DMA finished\n"); |
| @@ -1073,9 +1027,9 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1073 | /* No more interrupts */ | 1027 | /* No more interrupts */ |
| 1074 | if ((stat & DRQ_STAT) == 0) { | 1028 | if ((stat & DRQ_STAT) == 0) { |
| 1075 | debug_log(DBG_SENSE, "Packet command completed, %d bytes" | 1029 | debug_log(DBG_SENSE, "Packet command completed, %d bytes" |
| 1076 | " transferred\n", pc->actually_transferred); | 1030 | " transferred\n", pc->xferred); |
| 1077 | 1031 | ||
| 1078 | clear_bit(PC_DMA_IN_PROGRESS, &pc->flags); | 1032 | pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; |
| 1079 | local_irq_enable(); | 1033 | local_irq_enable(); |
| 1080 | 1034 | ||
| 1081 | #if SIMULATE_ERRORS | 1035 | #if SIMULATE_ERRORS |
| @@ -1088,7 +1042,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1088 | #endif | 1042 | #endif |
| 1089 | if ((stat & ERR_STAT) && pc->c[0] == REQUEST_SENSE) | 1043 | if ((stat & ERR_STAT) && pc->c[0] == REQUEST_SENSE) |
| 1090 | stat &= ~ERR_STAT; | 1044 | stat &= ~ERR_STAT; |
| 1091 | if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) { | 1045 | if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) { |
| 1092 | /* Error detected */ | 1046 | /* Error detected */ |
| 1093 | debug_log(DBG_ERR, "%s: I/O error\n", tape->name); | 1047 | debug_log(DBG_ERR, "%s: I/O error\n", tape->name); |
| 1094 | 1048 | ||
| @@ -1104,7 +1058,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1104 | return idetape_retry_pc(drive); | 1058 | return idetape_retry_pc(drive); |
| 1105 | } | 1059 | } |
| 1106 | pc->error = 0; | 1060 | pc->error = 0; |
| 1107 | if (test_bit(PC_WAIT_FOR_DSC, &pc->flags) && | 1061 | if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) && |
| 1108 | (stat & SEEK_STAT) == 0) { | 1062 | (stat & SEEK_STAT) == 0) { |
| 1109 | /* Media access command */ | 1063 | /* Media access command */ |
| 1110 | tape->dsc_polling_start = jiffies; | 1064 | tape->dsc_polling_start = jiffies; |
| @@ -1117,9 +1071,11 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1117 | if (tape->failed_pc == pc) | 1071 | if (tape->failed_pc == pc) |
| 1118 | tape->failed_pc = NULL; | 1072 | tape->failed_pc = NULL; |
| 1119 | /* Command finished - Call the callback function */ | 1073 | /* Command finished - Call the callback function */ |
| 1120 | return pc->callback(drive); | 1074 | return pc->idetape_callback(drive); |
| 1121 | } | 1075 | } |
| 1122 | if (test_and_clear_bit(PC_DMA_IN_PROGRESS, &pc->flags)) { | 1076 | |
| 1077 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { | ||
| 1078 | pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; | ||
| 1123 | printk(KERN_ERR "ide-tape: The tape wants to issue more " | 1079 | printk(KERN_ERR "ide-tape: The tape wants to issue more " |
| 1124 | "interrupts in DMA mode\n"); | 1080 | "interrupts in DMA mode\n"); |
| 1125 | printk(KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n"); | 1081 | printk(KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n"); |
| @@ -1127,16 +1083,16 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1127 | return ide_do_reset(drive); | 1083 | return ide_do_reset(drive); |
| 1128 | } | 1084 | } |
| 1129 | /* Get the number of bytes to transfer on this interrupt. */ | 1085 | /* Get the number of bytes to transfer on this interrupt. */ |
| 1130 | bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | | 1086 | bcount = (hwif->INB(hwif->io_ports[IDE_BCOUNTH_OFFSET]) << 8) | |
| 1131 | hwif->INB(IDE_BCOUNTL_REG); | 1087 | hwif->INB(hwif->io_ports[IDE_BCOUNTL_OFFSET]); |
| 1132 | 1088 | ||
| 1133 | ireason = hwif->INB(IDE_IREASON_REG); | 1089 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); |
| 1134 | 1090 | ||
| 1135 | if (ireason & CD) { | 1091 | if (ireason & CD) { |
| 1136 | printk(KERN_ERR "ide-tape: CoD != 0 in %s\n", __func__); | 1092 | printk(KERN_ERR "ide-tape: CoD != 0 in %s\n", __func__); |
| 1137 | return ide_do_reset(drive); | 1093 | return ide_do_reset(drive); |
| 1138 | } | 1094 | } |
| 1139 | if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) { | 1095 | if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) { |
| 1140 | /* Hopefully, we will never get here */ | 1096 | /* Hopefully, we will never get here */ |
| 1141 | printk(KERN_ERR "ide-tape: We wanted to %s, ", | 1097 | printk(KERN_ERR "ide-tape: We wanted to %s, ", |
| 1142 | (ireason & IO) ? "Write" : "Read"); | 1098 | (ireason & IO) ? "Write" : "Read"); |
| @@ -1144,15 +1100,15 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1144 | (ireason & IO) ? "Read" : "Write"); | 1100 | (ireason & IO) ? "Read" : "Write"); |
| 1145 | return ide_do_reset(drive); | 1101 | return ide_do_reset(drive); |
| 1146 | } | 1102 | } |
| 1147 | if (!test_bit(PC_WRITING, &pc->flags)) { | 1103 | if (!(pc->flags & PC_FLAG_WRITING)) { |
| 1148 | /* Reading - Check that we have enough space */ | 1104 | /* Reading - Check that we have enough space */ |
| 1149 | temp = pc->actually_transferred + bcount; | 1105 | temp = pc->xferred + bcount; |
| 1150 | if (temp > pc->request_transfer) { | 1106 | if (temp > pc->req_xfer) { |
| 1151 | if (temp > pc->buffer_size) { | 1107 | if (temp > pc->buf_size) { |
| 1152 | printk(KERN_ERR "ide-tape: The tape wants to " | 1108 | printk(KERN_ERR "ide-tape: The tape wants to " |
| 1153 | "send us more data than expected " | 1109 | "send us more data than expected " |
| 1154 | "- discarding data\n"); | 1110 | "- discarding data\n"); |
| 1155 | idetape_discard_data(drive, bcount); | 1111 | ide_atapi_discard_data(drive, bcount); |
| 1156 | ide_set_handler(drive, &idetape_pc_intr, | 1112 | ide_set_handler(drive, &idetape_pc_intr, |
| 1157 | IDETAPE_WAIT_CMD, NULL); | 1113 | IDETAPE_WAIT_CMD, NULL); |
| 1158 | return ide_started; | 1114 | return ide_started; |
| @@ -1170,11 +1126,11 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | |||
| 1170 | if (pc->bh) | 1126 | if (pc->bh) |
| 1171 | iobuf(drive, pc, bcount); | 1127 | iobuf(drive, pc, bcount); |
| 1172 | else | 1128 | else |
| 1173 | xferfunc(drive, pc->current_position, bcount); | 1129 | xferfunc(drive, pc->cur_pos, bcount); |
| 1174 | 1130 | ||
| 1175 | /* Update the current position */ | 1131 | /* Update the current position */ |
| 1176 | pc->actually_transferred += bcount; | 1132 | pc->xferred += bcount; |
| 1177 | pc->current_position += bcount; | 1133 | pc->cur_pos += bcount; |
| 1178 | 1134 | ||
| 1179 | debug_log(DBG_SENSE, "[cmd %x] transferred %d bytes on that intr.\n", | 1135 | debug_log(DBG_SENSE, "[cmd %x] transferred %d bytes on that intr.\n", |
| 1180 | pc->c[0], bcount); | 1136 | pc->c[0], bcount); |
| @@ -1224,7 +1180,7 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) | |||
| 1224 | { | 1180 | { |
| 1225 | ide_hwif_t *hwif = drive->hwif; | 1181 | ide_hwif_t *hwif = drive->hwif; |
| 1226 | idetape_tape_t *tape = drive->driver_data; | 1182 | idetape_tape_t *tape = drive->driver_data; |
| 1227 | idetape_pc_t *pc = tape->pc; | 1183 | struct ide_atapi_pc *pc = tape->pc; |
| 1228 | int retries = 100; | 1184 | int retries = 100; |
| 1229 | ide_startstop_t startstop; | 1185 | ide_startstop_t startstop; |
| 1230 | u8 ireason; | 1186 | u8 ireason; |
| @@ -1234,12 +1190,12 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) | |||
| 1234 | "yet DRQ isn't asserted\n"); | 1190 | "yet DRQ isn't asserted\n"); |
| 1235 | return startstop; | 1191 | return startstop; |
| 1236 | } | 1192 | } |
| 1237 | ireason = hwif->INB(IDE_IREASON_REG); | 1193 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); |
| 1238 | while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) { | 1194 | while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) { |
| 1239 | printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing " | 1195 | printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing " |
| 1240 | "a packet command, retrying\n"); | 1196 | "a packet command, retrying\n"); |
| 1241 | udelay(100); | 1197 | udelay(100); |
| 1242 | ireason = hwif->INB(IDE_IREASON_REG); | 1198 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); |
| 1243 | if (retries == 0) { | 1199 | if (retries == 0) { |
| 1244 | printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while " | 1200 | printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while " |
| 1245 | "issuing a packet command, ignoring\n"); | 1201 | "issuing a packet command, ignoring\n"); |
| @@ -1256,7 +1212,7 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) | |||
| 1256 | ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); | 1212 | ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); |
| 1257 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1213 | #ifdef CONFIG_BLK_DEV_IDEDMA |
| 1258 | /* Begin DMA, if necessary */ | 1214 | /* Begin DMA, if necessary */ |
| 1259 | if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) | 1215 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) |
| 1260 | hwif->dma_start(drive); | 1216 | hwif->dma_start(drive); |
| 1261 | #endif | 1217 | #endif |
| 1262 | /* Send the actual packet */ | 1218 | /* Send the actual packet */ |
| @@ -1264,7 +1220,8 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) | |||
| 1264 | return ide_started; | 1220 | return ide_started; |
| 1265 | } | 1221 | } |
| 1266 | 1222 | ||
| 1267 | static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, idetape_pc_t *pc) | 1223 | static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, |
| 1224 | struct ide_atapi_pc *pc) | ||
| 1268 | { | 1225 | { |
| 1269 | ide_hwif_t *hwif = drive->hwif; | 1226 | ide_hwif_t *hwif = drive->hwif; |
| 1270 | idetape_tape_t *tape = drive->driver_data; | 1227 | idetape_tape_t *tape = drive->driver_data; |
| @@ -1283,13 +1240,13 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, idetape_pc_t *pc) | |||
| 1283 | tape->pc = pc; | 1240 | tape->pc = pc; |
| 1284 | 1241 | ||
| 1285 | if (pc->retries > IDETAPE_MAX_PC_RETRIES || | 1242 | if (pc->retries > IDETAPE_MAX_PC_RETRIES || |
| 1286 | test_bit(PC_ABORT, &pc->flags)) { | 1243 | (pc->flags & PC_FLAG_ABORT)) { |
| 1287 | /* | 1244 | /* |
| 1288 | * We will "abort" retrying a packet command in case legitimate | 1245 | * We will "abort" retrying a packet command in case legitimate |
| 1289 | * error code was received (crossing a filemark, or end of the | 1246 | * error code was received (crossing a filemark, or end of the |
| 1290 | * media, for example). | 1247 | * media, for example). |
| 1291 | */ | 1248 | */ |
| 1292 | if (!test_bit(PC_ABORT, &pc->flags)) { | 1249 | if (!(pc->flags & PC_FLAG_ABORT)) { |
| 1293 | if (!(pc->c[0] == TEST_UNIT_READY && | 1250 | if (!(pc->c[0] == TEST_UNIT_READY && |
| 1294 | tape->sense_key == 2 && tape->asc == 4 && | 1251 | tape->sense_key == 2 && tape->asc == 4 && |
| 1295 | (tape->ascq == 1 || tape->ascq == 8))) { | 1252 | (tape->ascq == 1 || tape->ascq == 8))) { |
| @@ -1304,36 +1261,38 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, idetape_pc_t *pc) | |||
| 1304 | pc->error = IDETAPE_ERROR_GENERAL; | 1261 | pc->error = IDETAPE_ERROR_GENERAL; |
| 1305 | } | 1262 | } |
| 1306 | tape->failed_pc = NULL; | 1263 | tape->failed_pc = NULL; |
| 1307 | return pc->callback(drive); | 1264 | return pc->idetape_callback(drive); |
| 1308 | } | 1265 | } |
| 1309 | debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]); | 1266 | debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]); |
| 1310 | 1267 | ||
| 1311 | pc->retries++; | 1268 | pc->retries++; |
| 1312 | /* We haven't transferred any data yet */ | 1269 | /* We haven't transferred any data yet */ |
| 1313 | pc->actually_transferred = 0; | 1270 | pc->xferred = 0; |
| 1314 | pc->current_position = pc->buffer; | 1271 | pc->cur_pos = pc->buf; |
| 1315 | /* Request to transfer the entire buffer at once */ | 1272 | /* Request to transfer the entire buffer at once */ |
| 1316 | bcount = pc->request_transfer; | 1273 | bcount = pc->req_xfer; |
| 1317 | 1274 | ||
| 1318 | if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) { | 1275 | if (pc->flags & PC_FLAG_DMA_ERROR) { |
| 1276 | pc->flags &= ~PC_FLAG_DMA_ERROR; | ||
| 1319 | printk(KERN_WARNING "ide-tape: DMA disabled, " | 1277 | printk(KERN_WARNING "ide-tape: DMA disabled, " |
| 1320 | "reverting to PIO\n"); | 1278 | "reverting to PIO\n"); |
| 1321 | ide_dma_off(drive); | 1279 | ide_dma_off(drive); |
| 1322 | } | 1280 | } |
| 1323 | if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) | 1281 | if ((pc->flags & PC_FLAG_DMA_RECOMMENDED) && drive->using_dma) |
| 1324 | dma_ok = !hwif->dma_setup(drive); | 1282 | dma_ok = !hwif->dma_setup(drive); |
| 1325 | 1283 | ||
| 1326 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK | | 1284 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK | |
| 1327 | IDE_TFLAG_OUT_DEVICE, bcount, dma_ok); | 1285 | IDE_TFLAG_OUT_DEVICE, bcount, dma_ok); |
| 1328 | 1286 | ||
| 1329 | if (dma_ok) /* Will begin DMA later */ | 1287 | if (dma_ok) |
| 1330 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); | 1288 | /* Will begin DMA later */ |
| 1331 | if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) { | 1289 | pc->flags |= PC_FLAG_DMA_IN_PROGRESS; |
| 1290 | if (test_bit(IDETAPE_FLAG_DRQ_INTERRUPT, &tape->flags)) { | ||
| 1332 | ide_execute_command(drive, WIN_PACKETCMD, &idetape_transfer_pc, | 1291 | ide_execute_command(drive, WIN_PACKETCMD, &idetape_transfer_pc, |
| 1333 | IDETAPE_WAIT_CMD, NULL); | 1292 | IDETAPE_WAIT_CMD, NULL); |
| 1334 | return ide_started; | 1293 | return ide_started; |
| 1335 | } else { | 1294 | } else { |
| 1336 | hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG); | 1295 | hwif->OUTB(WIN_PACKETCMD, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 1337 | return idetape_transfer_pc(drive); | 1296 | return idetape_transfer_pc(drive); |
| 1338 | } | 1297 | } |
| 1339 | } | 1298 | } |
| @@ -1349,7 +1308,7 @@ static ide_startstop_t idetape_pc_callback(ide_drive_t *drive) | |||
| 1349 | } | 1308 | } |
| 1350 | 1309 | ||
| 1351 | /* A mode sense command is used to "sense" tape parameters. */ | 1310 | /* A mode sense command is used to "sense" tape parameters. */ |
| 1352 | static void idetape_create_mode_sense_cmd(idetape_pc_t *pc, u8 page_code) | 1311 | static void idetape_create_mode_sense_cmd(struct ide_atapi_pc *pc, u8 page_code) |
| 1353 | { | 1312 | { |
| 1354 | idetape_init_pc(pc); | 1313 | idetape_init_pc(pc); |
| 1355 | pc->c[0] = MODE_SENSE; | 1314 | pc->c[0] = MODE_SENSE; |
| @@ -1368,12 +1327,12 @@ static void idetape_create_mode_sense_cmd(idetape_pc_t *pc, u8 page_code) | |||
| 1368 | /* We will just discard data in that case */ | 1327 | /* We will just discard data in that case */ |
| 1369 | pc->c[4] = 255; | 1328 | pc->c[4] = 255; |
| 1370 | if (page_code == IDETAPE_BLOCK_DESCRIPTOR) | 1329 | if (page_code == IDETAPE_BLOCK_DESCRIPTOR) |
| 1371 | pc->request_transfer = 12; | 1330 | pc->req_xfer = 12; |
| 1372 | else if (page_code == IDETAPE_CAPABILITIES_PAGE) | 1331 | else if (page_code == IDETAPE_CAPABILITIES_PAGE) |
| 1373 | pc->request_transfer = 24; | 1332 | pc->req_xfer = 24; |
| 1374 | else | 1333 | else |
| 1375 | pc->request_transfer = 50; | 1334 | pc->req_xfer = 50; |
| 1376 | pc->callback = &idetape_pc_callback; | 1335 | pc->idetape_callback = &idetape_pc_callback; |
| 1377 | } | 1336 | } |
| 1378 | 1337 | ||
| 1379 | static void idetape_calculate_speeds(ide_drive_t *drive) | 1338 | static void idetape_calculate_speeds(ide_drive_t *drive) |
| @@ -1442,7 +1401,7 @@ static void idetape_calculate_speeds(ide_drive_t *drive) | |||
| 1442 | static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) | 1401 | static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) |
| 1443 | { | 1402 | { |
| 1444 | idetape_tape_t *tape = drive->driver_data; | 1403 | idetape_tape_t *tape = drive->driver_data; |
| 1445 | idetape_pc_t *pc = tape->pc; | 1404 | struct ide_atapi_pc *pc = tape->pc; |
| 1446 | u8 stat; | 1405 | u8 stat; |
| 1447 | 1406 | ||
| 1448 | stat = ide_read_status(drive); | 1407 | stat = ide_read_status(drive); |
| @@ -1463,14 +1422,14 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) | |||
| 1463 | pc->error = IDETAPE_ERROR_GENERAL; | 1422 | pc->error = IDETAPE_ERROR_GENERAL; |
| 1464 | tape->failed_pc = NULL; | 1423 | tape->failed_pc = NULL; |
| 1465 | } | 1424 | } |
| 1466 | return pc->callback(drive); | 1425 | return pc->idetape_callback(drive); |
| 1467 | } | 1426 | } |
| 1468 | 1427 | ||
| 1469 | static ide_startstop_t idetape_rw_callback(ide_drive_t *drive) | 1428 | static ide_startstop_t idetape_rw_callback(ide_drive_t *drive) |
| 1470 | { | 1429 | { |
| 1471 | idetape_tape_t *tape = drive->driver_data; | 1430 | idetape_tape_t *tape = drive->driver_data; |
| 1472 | struct request *rq = HWGROUP(drive)->rq; | 1431 | struct request *rq = HWGROUP(drive)->rq; |
| 1473 | int blocks = tape->pc->actually_transferred / tape->blk_size; | 1432 | int blocks = tape->pc->xferred / tape->blk_size; |
| 1474 | 1433 | ||
| 1475 | tape->avg_size += blocks * tape->blk_size; | 1434 | tape->avg_size += blocks * tape->blk_size; |
| 1476 | tape->insert_size += blocks * tape->blk_size; | 1435 | tape->insert_size += blocks * tape->blk_size; |
| @@ -1502,47 +1461,49 @@ static ide_startstop_t idetape_rw_callback(ide_drive_t *drive) | |||
| 1502 | return ide_stopped; | 1461 | return ide_stopped; |
| 1503 | } | 1462 | } |
| 1504 | 1463 | ||
| 1505 | static void idetape_create_read_cmd(idetape_tape_t *tape, idetape_pc_t *pc, | 1464 | static void idetape_create_read_cmd(idetape_tape_t *tape, |
| 1465 | struct ide_atapi_pc *pc, | ||
| 1506 | unsigned int length, struct idetape_bh *bh) | 1466 | unsigned int length, struct idetape_bh *bh) |
| 1507 | { | 1467 | { |
| 1508 | idetape_init_pc(pc); | 1468 | idetape_init_pc(pc); |
| 1509 | pc->c[0] = READ_6; | 1469 | pc->c[0] = READ_6; |
| 1510 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); | 1470 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); |
| 1511 | pc->c[1] = 1; | 1471 | pc->c[1] = 1; |
| 1512 | pc->callback = &idetape_rw_callback; | 1472 | pc->idetape_callback = &idetape_rw_callback; |
| 1513 | pc->bh = bh; | 1473 | pc->bh = bh; |
| 1514 | atomic_set(&bh->b_count, 0); | 1474 | atomic_set(&bh->b_count, 0); |
| 1515 | pc->buffer = NULL; | 1475 | pc->buf = NULL; |
| 1516 | pc->buffer_size = length * tape->blk_size; | 1476 | pc->buf_size = length * tape->blk_size; |
| 1517 | pc->request_transfer = pc->buffer_size; | 1477 | pc->req_xfer = pc->buf_size; |
| 1518 | if (pc->request_transfer == tape->stage_size) | 1478 | if (pc->req_xfer == tape->stage_size) |
| 1519 | set_bit(PC_DMA_RECOMMENDED, &pc->flags); | 1479 | pc->flags |= PC_FLAG_DMA_RECOMMENDED; |
| 1520 | } | 1480 | } |
| 1521 | 1481 | ||
| 1522 | static void idetape_create_write_cmd(idetape_tape_t *tape, idetape_pc_t *pc, | 1482 | static void idetape_create_write_cmd(idetape_tape_t *tape, |
| 1483 | struct ide_atapi_pc *pc, | ||
| 1523 | unsigned int length, struct idetape_bh *bh) | 1484 | unsigned int length, struct idetape_bh *bh) |
| 1524 | { | 1485 | { |
| 1525 | idetape_init_pc(pc); | 1486 | idetape_init_pc(pc); |
| 1526 | pc->c[0] = WRITE_6; | 1487 | pc->c[0] = WRITE_6; |
| 1527 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); | 1488 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); |
| 1528 | pc->c[1] = 1; | 1489 | pc->c[1] = 1; |
| 1529 | pc->callback = &idetape_rw_callback; | 1490 | pc->idetape_callback = &idetape_rw_callback; |
| 1530 | set_bit(PC_WRITING, &pc->flags); | 1491 | pc->flags |= PC_FLAG_WRITING; |
| 1531 | pc->bh = bh; | 1492 | pc->bh = bh; |
| 1532 | pc->b_data = bh->b_data; | 1493 | pc->b_data = bh->b_data; |
| 1533 | pc->b_count = atomic_read(&bh->b_count); | 1494 | pc->b_count = atomic_read(&bh->b_count); |
| 1534 | pc->buffer = NULL; | 1495 | pc->buf = NULL; |
| 1535 | pc->buffer_size = length * tape->blk_size; | 1496 | pc->buf_size = length * tape->blk_size; |
| 1536 | pc->request_transfer = pc->buffer_size; | 1497 | pc->req_xfer = pc->buf_size; |
| 1537 | if (pc->request_transfer == tape->stage_size) | 1498 | if (pc->req_xfer == tape->stage_size) |
| 1538 | set_bit(PC_DMA_RECOMMENDED, &pc->flags); | 1499 | pc->flags |= PC_FLAG_DMA_RECOMMENDED; |
| 1539 | } | 1500 | } |
| 1540 | 1501 | ||
| 1541 | static ide_startstop_t idetape_do_request(ide_drive_t *drive, | 1502 | static ide_startstop_t idetape_do_request(ide_drive_t *drive, |
| 1542 | struct request *rq, sector_t block) | 1503 | struct request *rq, sector_t block) |
| 1543 | { | 1504 | { |
| 1544 | idetape_tape_t *tape = drive->driver_data; | 1505 | idetape_tape_t *tape = drive->driver_data; |
| 1545 | idetape_pc_t *pc = NULL; | 1506 | struct ide_atapi_pc *pc = NULL; |
| 1546 | struct request *postponed_rq = tape->postponed_rq; | 1507 | struct request *postponed_rq = tape->postponed_rq; |
| 1547 | u8 stat; | 1508 | u8 stat; |
| 1548 | 1509 | ||
| @@ -1579,10 +1540,10 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
| 1579 | stat = ide_read_status(drive); | 1540 | stat = ide_read_status(drive); |
| 1580 | 1541 | ||
| 1581 | if (!drive->dsc_overlap && !(rq->cmd[0] & REQ_IDETAPE_PC2)) | 1542 | if (!drive->dsc_overlap && !(rq->cmd[0] & REQ_IDETAPE_PC2)) |
| 1582 | set_bit(IDETAPE_IGNORE_DSC, &tape->flags); | 1543 | set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags); |
| 1583 | 1544 | ||
| 1584 | if (drive->post_reset == 1) { | 1545 | if (drive->post_reset == 1) { |
| 1585 | set_bit(IDETAPE_IGNORE_DSC, &tape->flags); | 1546 | set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags); |
| 1586 | drive->post_reset = 0; | 1547 | drive->post_reset = 0; |
| 1587 | } | 1548 | } |
| 1588 | 1549 | ||
| @@ -1590,7 +1551,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
| 1590 | tape->insert_speed = tape->insert_size / 1024 * HZ / | 1551 | tape->insert_speed = tape->insert_size / 1024 * HZ / |
| 1591 | (jiffies - tape->insert_time); | 1552 | (jiffies - tape->insert_time); |
| 1592 | idetape_calculate_speeds(drive); | 1553 | idetape_calculate_speeds(drive); |
| 1593 | if (!test_and_clear_bit(IDETAPE_IGNORE_DSC, &tape->flags) && | 1554 | if (!test_and_clear_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags) && |
| 1594 | (stat & SEEK_STAT) == 0) { | 1555 | (stat & SEEK_STAT) == 0) { |
| 1595 | if (postponed_rq == NULL) { | 1556 | if (postponed_rq == NULL) { |
| 1596 | tape->dsc_polling_start = jiffies; | 1557 | tape->dsc_polling_start = jiffies; |
| @@ -1629,7 +1590,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
| 1629 | goto out; | 1590 | goto out; |
| 1630 | } | 1591 | } |
| 1631 | if (rq->cmd[0] & REQ_IDETAPE_PC1) { | 1592 | if (rq->cmd[0] & REQ_IDETAPE_PC1) { |
| 1632 | pc = (idetape_pc_t *) rq->buffer; | 1593 | pc = (struct ide_atapi_pc *) rq->buffer; |
| 1633 | rq->cmd[0] &= ~(REQ_IDETAPE_PC1); | 1594 | rq->cmd[0] &= ~(REQ_IDETAPE_PC1); |
| 1634 | rq->cmd[0] |= REQ_IDETAPE_PC2; | 1595 | rq->cmd[0] |= REQ_IDETAPE_PC2; |
| 1635 | goto out; | 1596 | goto out; |
| @@ -1648,7 +1609,7 @@ static inline int idetape_pipeline_active(idetape_tape_t *tape) | |||
| 1648 | { | 1609 | { |
| 1649 | int rc1, rc2; | 1610 | int rc1, rc2; |
| 1650 | 1611 | ||
| 1651 | rc1 = test_bit(IDETAPE_PIPELINE_ACTIVE, &tape->flags); | 1612 | rc1 = test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags); |
| 1652 | rc2 = (tape->active_data_rq != NULL); | 1613 | rc2 = (tape->active_data_rq != NULL); |
| 1653 | return rc1; | 1614 | return rc1; |
| 1654 | } | 1615 | } |
| @@ -1881,7 +1842,7 @@ static void idetape_wait_for_request(ide_drive_t *drive, struct request *rq) | |||
| 1881 | static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive) | 1842 | static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive) |
| 1882 | { | 1843 | { |
| 1883 | idetape_tape_t *tape = drive->driver_data; | 1844 | idetape_tape_t *tape = drive->driver_data; |
| 1884 | u8 *readpos = tape->pc->buffer; | 1845 | u8 *readpos = tape->pc->buf; |
| 1885 | 1846 | ||
| 1886 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | 1847 | debug_log(DBG_PROCS, "Enter %s\n", __func__); |
| 1887 | 1848 | ||
| @@ -1894,7 +1855,7 @@ static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive) | |||
| 1894 | if (readpos[0] & 0x4) { | 1855 | if (readpos[0] & 0x4) { |
| 1895 | printk(KERN_INFO "ide-tape: Block location is unknown" | 1856 | printk(KERN_INFO "ide-tape: Block location is unknown" |
| 1896 | "to the tape\n"); | 1857 | "to the tape\n"); |
| 1897 | clear_bit(IDETAPE_ADDRESS_VALID, &tape->flags); | 1858 | clear_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags); |
| 1898 | idetape_end_request(drive, 0, 0); | 1859 | idetape_end_request(drive, 0, 0); |
| 1899 | } else { | 1860 | } else { |
| 1900 | debug_log(DBG_SENSE, "Block Location - %u\n", | 1861 | debug_log(DBG_SENSE, "Block Location - %u\n", |
| @@ -1903,7 +1864,7 @@ static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive) | |||
| 1903 | tape->partition = readpos[1]; | 1864 | tape->partition = readpos[1]; |
| 1904 | tape->first_frame = | 1865 | tape->first_frame = |
| 1905 | be32_to_cpu(*(u32 *)&readpos[4]); | 1866 | be32_to_cpu(*(u32 *)&readpos[4]); |
| 1906 | set_bit(IDETAPE_ADDRESS_VALID, &tape->flags); | 1867 | set_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags); |
| 1907 | idetape_end_request(drive, 1, 0); | 1868 | idetape_end_request(drive, 1, 0); |
| 1908 | } | 1869 | } |
| 1909 | } else { | 1870 | } else { |
| @@ -1917,20 +1878,20 @@ static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive) | |||
| 1917 | * writing a filemark otherwise. | 1878 | * writing a filemark otherwise. |
| 1918 | */ | 1879 | */ |
| 1919 | static void idetape_create_write_filemark_cmd(ide_drive_t *drive, | 1880 | static void idetape_create_write_filemark_cmd(ide_drive_t *drive, |
| 1920 | idetape_pc_t *pc, int write_filemark) | 1881 | struct ide_atapi_pc *pc, int write_filemark) |
| 1921 | { | 1882 | { |
| 1922 | idetape_init_pc(pc); | 1883 | idetape_init_pc(pc); |
| 1923 | pc->c[0] = WRITE_FILEMARKS; | 1884 | pc->c[0] = WRITE_FILEMARKS; |
| 1924 | pc->c[4] = write_filemark; | 1885 | pc->c[4] = write_filemark; |
| 1925 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 1886 | pc->flags |= PC_FLAG_WAIT_FOR_DSC; |
| 1926 | pc->callback = &idetape_pc_callback; | 1887 | pc->idetape_callback = &idetape_pc_callback; |
| 1927 | } | 1888 | } |
| 1928 | 1889 | ||
| 1929 | static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc) | 1890 | static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc) |
| 1930 | { | 1891 | { |
| 1931 | idetape_init_pc(pc); | 1892 | idetape_init_pc(pc); |
| 1932 | pc->c[0] = TEST_UNIT_READY; | 1893 | pc->c[0] = TEST_UNIT_READY; |
| 1933 | pc->callback = &idetape_pc_callback; | 1894 | pc->idetape_callback = &idetape_pc_callback; |
| 1934 | } | 1895 | } |
| 1935 | 1896 | ||
| 1936 | /* | 1897 | /* |
| @@ -1946,7 +1907,7 @@ static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc) | |||
| 1946 | * to the request list without waiting for it to be serviced! In that case, we | 1907 | * to the request list without waiting for it to be serviced! In that case, we |
| 1947 | * usually use idetape_queue_pc_head(). | 1908 | * usually use idetape_queue_pc_head(). |
| 1948 | */ | 1909 | */ |
| 1949 | static int __idetape_queue_pc_tail(ide_drive_t *drive, idetape_pc_t *pc) | 1910 | static int __idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) |
| 1950 | { | 1911 | { |
| 1951 | struct ide_tape_obj *tape = drive->driver_data; | 1912 | struct ide_tape_obj *tape = drive->driver_data; |
| 1952 | struct request rq; | 1913 | struct request rq; |
| @@ -1957,24 +1918,24 @@ static int __idetape_queue_pc_tail(ide_drive_t *drive, idetape_pc_t *pc) | |||
| 1957 | return ide_do_drive_cmd(drive, &rq, ide_wait); | 1918 | return ide_do_drive_cmd(drive, &rq, ide_wait); |
| 1958 | } | 1919 | } |
| 1959 | 1920 | ||
| 1960 | static void idetape_create_load_unload_cmd(ide_drive_t *drive, idetape_pc_t *pc, | 1921 | static void idetape_create_load_unload_cmd(ide_drive_t *drive, |
| 1961 | int cmd) | 1922 | struct ide_atapi_pc *pc, int cmd) |
| 1962 | { | 1923 | { |
| 1963 | idetape_init_pc(pc); | 1924 | idetape_init_pc(pc); |
| 1964 | pc->c[0] = START_STOP; | 1925 | pc->c[0] = START_STOP; |
| 1965 | pc->c[4] = cmd; | 1926 | pc->c[4] = cmd; |
| 1966 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 1927 | pc->flags |= PC_FLAG_WAIT_FOR_DSC; |
| 1967 | pc->callback = &idetape_pc_callback; | 1928 | pc->idetape_callback = &idetape_pc_callback; |
| 1968 | } | 1929 | } |
| 1969 | 1930 | ||
| 1970 | static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) | 1931 | static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) |
| 1971 | { | 1932 | { |
| 1972 | idetape_tape_t *tape = drive->driver_data; | 1933 | idetape_tape_t *tape = drive->driver_data; |
| 1973 | idetape_pc_t pc; | 1934 | struct ide_atapi_pc pc; |
| 1974 | int load_attempted = 0; | 1935 | int load_attempted = 0; |
| 1975 | 1936 | ||
| 1976 | /* Wait for the tape to become ready */ | 1937 | /* Wait for the tape to become ready */ |
| 1977 | set_bit(IDETAPE_MEDIUM_PRESENT, &tape->flags); | 1938 | set_bit(IDETAPE_FLAG_MEDIUM_PRESENT, &tape->flags); |
| 1978 | timeout += jiffies; | 1939 | timeout += jiffies; |
| 1979 | while (time_before(jiffies, timeout)) { | 1940 | while (time_before(jiffies, timeout)) { |
| 1980 | idetape_create_test_unit_ready_cmd(&pc); | 1941 | idetape_create_test_unit_ready_cmd(&pc); |
| @@ -1998,14 +1959,14 @@ static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) | |||
| 1998 | return -EIO; | 1959 | return -EIO; |
| 1999 | } | 1960 | } |
| 2000 | 1961 | ||
| 2001 | static int idetape_queue_pc_tail(ide_drive_t *drive, idetape_pc_t *pc) | 1962 | static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) |
| 2002 | { | 1963 | { |
| 2003 | return __idetape_queue_pc_tail(drive, pc); | 1964 | return __idetape_queue_pc_tail(drive, pc); |
| 2004 | } | 1965 | } |
| 2005 | 1966 | ||
| 2006 | static int idetape_flush_tape_buffers(ide_drive_t *drive) | 1967 | static int idetape_flush_tape_buffers(ide_drive_t *drive) |
| 2007 | { | 1968 | { |
| 2008 | idetape_pc_t pc; | 1969 | struct ide_atapi_pc pc; |
| 2009 | int rc; | 1970 | int rc; |
| 2010 | 1971 | ||
| 2011 | idetape_create_write_filemark_cmd(drive, &pc, 0); | 1972 | idetape_create_write_filemark_cmd(drive, &pc, 0); |
| @@ -2016,18 +1977,18 @@ static int idetape_flush_tape_buffers(ide_drive_t *drive) | |||
| 2016 | return 0; | 1977 | return 0; |
| 2017 | } | 1978 | } |
| 2018 | 1979 | ||
| 2019 | static void idetape_create_read_position_cmd(idetape_pc_t *pc) | 1980 | static void idetape_create_read_position_cmd(struct ide_atapi_pc *pc) |
| 2020 | { | 1981 | { |
| 2021 | idetape_init_pc(pc); | 1982 | idetape_init_pc(pc); |
| 2022 | pc->c[0] = READ_POSITION; | 1983 | pc->c[0] = READ_POSITION; |
| 2023 | pc->request_transfer = 20; | 1984 | pc->req_xfer = 20; |
| 2024 | pc->callback = &idetape_read_position_callback; | 1985 | pc->idetape_callback = &idetape_read_position_callback; |
| 2025 | } | 1986 | } |
| 2026 | 1987 | ||
| 2027 | static int idetape_read_position(ide_drive_t *drive) | 1988 | static int idetape_read_position(ide_drive_t *drive) |
| 2028 | { | 1989 | { |
| 2029 | idetape_tape_t *tape = drive->driver_data; | 1990 | idetape_tape_t *tape = drive->driver_data; |
| 2030 | idetape_pc_t pc; | 1991 | struct ide_atapi_pc pc; |
| 2031 | int position; | 1992 | int position; |
| 2032 | 1993 | ||
| 2033 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | 1994 | debug_log(DBG_PROCS, "Enter %s\n", __func__); |
| @@ -2039,7 +2000,8 @@ static int idetape_read_position(ide_drive_t *drive) | |||
| 2039 | return position; | 2000 | return position; |
| 2040 | } | 2001 | } |
| 2041 | 2002 | ||
| 2042 | static void idetape_create_locate_cmd(ide_drive_t *drive, idetape_pc_t *pc, | 2003 | static void idetape_create_locate_cmd(ide_drive_t *drive, |
| 2004 | struct ide_atapi_pc *pc, | ||
| 2043 | unsigned int block, u8 partition, int skip) | 2005 | unsigned int block, u8 partition, int skip) |
| 2044 | { | 2006 | { |
| 2045 | idetape_init_pc(pc); | 2007 | idetape_init_pc(pc); |
| @@ -2047,12 +2009,12 @@ static void idetape_create_locate_cmd(ide_drive_t *drive, idetape_pc_t *pc, | |||
| 2047 | pc->c[1] = 2; | 2009 | pc->c[1] = 2; |
| 2048 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]); | 2010 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]); |
| 2049 | pc->c[8] = partition; | 2011 | pc->c[8] = partition; |
| 2050 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2012 | pc->flags |= PC_FLAG_WAIT_FOR_DSC; |
| 2051 | pc->callback = &idetape_pc_callback; | 2013 | pc->idetape_callback = &idetape_pc_callback; |
| 2052 | } | 2014 | } |
| 2053 | 2015 | ||
| 2054 | static int idetape_create_prevent_cmd(ide_drive_t *drive, idetape_pc_t *pc, | 2016 | static int idetape_create_prevent_cmd(ide_drive_t *drive, |
| 2055 | int prevent) | 2017 | struct ide_atapi_pc *pc, int prevent) |
| 2056 | { | 2018 | { |
| 2057 | idetape_tape_t *tape = drive->driver_data; | 2019 | idetape_tape_t *tape = drive->driver_data; |
| 2058 | 2020 | ||
| @@ -2063,7 +2025,7 @@ static int idetape_create_prevent_cmd(ide_drive_t *drive, idetape_pc_t *pc, | |||
| 2063 | idetape_init_pc(pc); | 2025 | idetape_init_pc(pc); |
| 2064 | pc->c[0] = ALLOW_MEDIUM_REMOVAL; | 2026 | pc->c[0] = ALLOW_MEDIUM_REMOVAL; |
| 2065 | pc->c[4] = prevent; | 2027 | pc->c[4] = prevent; |
| 2066 | pc->callback = &idetape_pc_callback; | 2028 | pc->idetape_callback = &idetape_pc_callback; |
| 2067 | return 1; | 2029 | return 1; |
| 2068 | } | 2030 | } |
| 2069 | 2031 | ||
| @@ -2078,7 +2040,7 @@ static int __idetape_discard_read_pipeline(ide_drive_t *drive) | |||
| 2078 | 2040 | ||
| 2079 | /* Remove merge stage. */ | 2041 | /* Remove merge stage. */ |
| 2080 | cnt = tape->merge_stage_size / tape->blk_size; | 2042 | cnt = tape->merge_stage_size / tape->blk_size; |
| 2081 | if (test_and_clear_bit(IDETAPE_FILEMARK, &tape->flags)) | 2043 | if (test_and_clear_bit(IDETAPE_FLAG_FILEMARK, &tape->flags)) |
| 2082 | ++cnt; /* Filemarks count as 1 sector */ | 2044 | ++cnt; /* Filemarks count as 1 sector */ |
| 2083 | tape->merge_stage_size = 0; | 2045 | tape->merge_stage_size = 0; |
| 2084 | if (tape->merge_stage != NULL) { | 2046 | if (tape->merge_stage != NULL) { |
| @@ -2087,7 +2049,7 @@ static int __idetape_discard_read_pipeline(ide_drive_t *drive) | |||
| 2087 | } | 2049 | } |
| 2088 | 2050 | ||
| 2089 | /* Clear pipeline flags. */ | 2051 | /* Clear pipeline flags. */ |
| 2090 | clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | 2052 | clear_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags); |
| 2091 | tape->chrdev_dir = IDETAPE_DIR_NONE; | 2053 | tape->chrdev_dir = IDETAPE_DIR_NONE; |
| 2092 | 2054 | ||
| 2093 | /* Remove pipeline stages. */ | 2055 | /* Remove pipeline stages. */ |
| @@ -2124,7 +2086,7 @@ static int idetape_position_tape(ide_drive_t *drive, unsigned int block, | |||
| 2124 | { | 2086 | { |
| 2125 | idetape_tape_t *tape = drive->driver_data; | 2087 | idetape_tape_t *tape = drive->driver_data; |
| 2126 | int retval; | 2088 | int retval; |
| 2127 | idetape_pc_t pc; | 2089 | struct ide_atapi_pc pc; |
| 2128 | 2090 | ||
| 2129 | if (tape->chrdev_dir == IDETAPE_DIR_READ) | 2091 | if (tape->chrdev_dir == IDETAPE_DIR_READ) |
| 2130 | __idetape_discard_read_pipeline(drive); | 2092 | __idetape_discard_read_pipeline(drive); |
| @@ -2201,46 +2163,47 @@ static void idetape_plug_pipeline(ide_drive_t *drive) | |||
| 2201 | if (tape->next_stage == NULL) | 2163 | if (tape->next_stage == NULL) |
| 2202 | return; | 2164 | return; |
| 2203 | if (!idetape_pipeline_active(tape)) { | 2165 | if (!idetape_pipeline_active(tape)) { |
| 2204 | set_bit(IDETAPE_PIPELINE_ACTIVE, &tape->flags); | 2166 | set_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags); |
| 2205 | idetape_activate_next_stage(drive); | 2167 | idetape_activate_next_stage(drive); |
| 2206 | (void) ide_do_drive_cmd(drive, tape->active_data_rq, ide_end); | 2168 | (void) ide_do_drive_cmd(drive, tape->active_data_rq, ide_end); |
| 2207 | } | 2169 | } |
| 2208 | } | 2170 | } |
| 2209 | 2171 | ||
| 2210 | static void idetape_create_inquiry_cmd(idetape_pc_t *pc) | 2172 | static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc) |
| 2211 | { | 2173 | { |
| 2212 | idetape_init_pc(pc); | 2174 | idetape_init_pc(pc); |
| 2213 | pc->c[0] = INQUIRY; | 2175 | pc->c[0] = INQUIRY; |
| 2214 | pc->c[4] = 254; | 2176 | pc->c[4] = 254; |
| 2215 | pc->request_transfer = 254; | 2177 | pc->req_xfer = 254; |
| 2216 | pc->callback = &idetape_pc_callback; | 2178 | pc->idetape_callback = &idetape_pc_callback; |
| 2217 | } | 2179 | } |
| 2218 | 2180 | ||
| 2219 | static void idetape_create_rewind_cmd(ide_drive_t *drive, idetape_pc_t *pc) | 2181 | static void idetape_create_rewind_cmd(ide_drive_t *drive, |
| 2182 | struct ide_atapi_pc *pc) | ||
| 2220 | { | 2183 | { |
| 2221 | idetape_init_pc(pc); | 2184 | idetape_init_pc(pc); |
| 2222 | pc->c[0] = REZERO_UNIT; | 2185 | pc->c[0] = REZERO_UNIT; |
| 2223 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2186 | pc->flags |= PC_FLAG_WAIT_FOR_DSC; |
| 2224 | pc->callback = &idetape_pc_callback; | 2187 | pc->idetape_callback = &idetape_pc_callback; |
| 2225 | } | 2188 | } |
| 2226 | 2189 | ||
| 2227 | static void idetape_create_erase_cmd(idetape_pc_t *pc) | 2190 | static void idetape_create_erase_cmd(struct ide_atapi_pc *pc) |
| 2228 | { | 2191 | { |
| 2229 | idetape_init_pc(pc); | 2192 | idetape_init_pc(pc); |
| 2230 | pc->c[0] = ERASE; | 2193 | pc->c[0] = ERASE; |
| 2231 | pc->c[1] = 1; | 2194 | pc->c[1] = 1; |
| 2232 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2195 | pc->flags |= PC_FLAG_WAIT_FOR_DSC; |
| 2233 | pc->callback = &idetape_pc_callback; | 2196 | pc->idetape_callback = &idetape_pc_callback; |
| 2234 | } | 2197 | } |
| 2235 | 2198 | ||
| 2236 | static void idetape_create_space_cmd(idetape_pc_t *pc, int count, u8 cmd) | 2199 | static void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd) |
| 2237 | { | 2200 | { |
| 2238 | idetape_init_pc(pc); | 2201 | idetape_init_pc(pc); |
| 2239 | pc->c[0] = SPACE; | 2202 | pc->c[0] = SPACE; |
| 2240 | put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]); | 2203 | put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]); |
| 2241 | pc->c[1] = cmd; | 2204 | pc->c[1] = cmd; |
| 2242 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2205 | pc->flags |= PC_FLAG_WAIT_FOR_DSC; |
| 2243 | pc->callback = &idetape_pc_callback; | 2206 | pc->idetape_callback = &idetape_pc_callback; |
| 2244 | } | 2207 | } |
| 2245 | 2208 | ||
| 2246 | static void idetape_wait_first_stage(ide_drive_t *drive) | 2209 | static void idetape_wait_first_stage(ide_drive_t *drive) |
| @@ -2326,7 +2289,7 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks) | |||
| 2326 | idetape_plug_pipeline(drive); | 2289 | idetape_plug_pipeline(drive); |
| 2327 | } | 2290 | } |
| 2328 | } | 2291 | } |
| 2329 | if (test_and_clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags)) | 2292 | if (test_and_clear_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags)) |
| 2330 | /* Return a deferred error */ | 2293 | /* Return a deferred error */ |
| 2331 | return -EIO; | 2294 | return -EIO; |
| 2332 | return blocks; | 2295 | return blocks; |
| @@ -2402,7 +2365,7 @@ static void idetape_empty_write_pipeline(ide_drive_t *drive) | |||
| 2402 | __idetape_kfree_stage(tape->merge_stage); | 2365 | __idetape_kfree_stage(tape->merge_stage); |
| 2403 | tape->merge_stage = NULL; | 2366 | tape->merge_stage = NULL; |
| 2404 | } | 2367 | } |
| 2405 | clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | 2368 | clear_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags); |
| 2406 | tape->chrdev_dir = IDETAPE_DIR_NONE; | 2369 | tape->chrdev_dir = IDETAPE_DIR_NONE; |
| 2407 | 2370 | ||
| 2408 | /* | 2371 | /* |
| @@ -2490,7 +2453,7 @@ static int idetape_init_read(ide_drive_t *drive, int max_stages) | |||
| 2490 | rq.sector = tape->first_frame; | 2453 | rq.sector = tape->first_frame; |
| 2491 | rq.nr_sectors = blocks; | 2454 | rq.nr_sectors = blocks; |
| 2492 | rq.current_nr_sectors = blocks; | 2455 | rq.current_nr_sectors = blocks; |
| 2493 | if (!test_bit(IDETAPE_PIPELINE_ERROR, &tape->flags) && | 2456 | if (!test_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags) && |
| 2494 | tape->nr_stages < max_stages) { | 2457 | tape->nr_stages < max_stages) { |
| 2495 | new_stage = idetape_kmalloc_stage(tape); | 2458 | new_stage = idetape_kmalloc_stage(tape); |
| 2496 | while (new_stage != NULL) { | 2459 | while (new_stage != NULL) { |
| @@ -2527,13 +2490,13 @@ static int idetape_add_chrdev_read_request(ide_drive_t *drive, int blocks) | |||
| 2527 | debug_log(DBG_PROCS, "Enter %s, %d blocks\n", __func__, blocks); | 2490 | debug_log(DBG_PROCS, "Enter %s, %d blocks\n", __func__, blocks); |
| 2528 | 2491 | ||
| 2529 | /* If we are at a filemark, return a read length of 0 */ | 2492 | /* If we are at a filemark, return a read length of 0 */ |
| 2530 | if (test_bit(IDETAPE_FILEMARK, &tape->flags)) | 2493 | if (test_bit(IDETAPE_FLAG_FILEMARK, &tape->flags)) |
| 2531 | return 0; | 2494 | return 0; |
| 2532 | 2495 | ||
| 2533 | /* Wait for the next block to reach the head of the pipeline. */ | 2496 | /* Wait for the next block to reach the head of the pipeline. */ |
| 2534 | idetape_init_read(drive, tape->max_stages); | 2497 | idetape_init_read(drive, tape->max_stages); |
| 2535 | if (tape->first_stage == NULL) { | 2498 | if (tape->first_stage == NULL) { |
| 2536 | if (test_bit(IDETAPE_PIPELINE_ERROR, &tape->flags)) | 2499 | if (test_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags)) |
| 2537 | return 0; | 2500 | return 0; |
| 2538 | return idetape_queue_rw_tail(drive, REQ_IDETAPE_READ, blocks, | 2501 | return idetape_queue_rw_tail(drive, REQ_IDETAPE_READ, blocks, |
| 2539 | tape->merge_stage->bh); | 2502 | tape->merge_stage->bh); |
| @@ -2550,7 +2513,7 @@ static int idetape_add_chrdev_read_request(ide_drive_t *drive, int blocks) | |||
| 2550 | else { | 2513 | else { |
| 2551 | idetape_switch_buffers(tape, tape->first_stage); | 2514 | idetape_switch_buffers(tape, tape->first_stage); |
| 2552 | if (rq_ptr->errors == IDETAPE_ERROR_FILEMARK) | 2515 | if (rq_ptr->errors == IDETAPE_ERROR_FILEMARK) |
| 2553 | set_bit(IDETAPE_FILEMARK, &tape->flags); | 2516 | set_bit(IDETAPE_FLAG_FILEMARK, &tape->flags); |
| 2554 | spin_lock_irqsave(&tape->lock, flags); | 2517 | spin_lock_irqsave(&tape->lock, flags); |
| 2555 | idetape_remove_stage_head(drive); | 2518 | idetape_remove_stage_head(drive); |
| 2556 | spin_unlock_irqrestore(&tape->lock, flags); | 2519 | spin_unlock_irqrestore(&tape->lock, flags); |
| @@ -2618,7 +2581,7 @@ static int idetape_pipeline_size(ide_drive_t *drive) | |||
| 2618 | static int idetape_rewind_tape(ide_drive_t *drive) | 2581 | static int idetape_rewind_tape(ide_drive_t *drive) |
| 2619 | { | 2582 | { |
| 2620 | int retval; | 2583 | int retval; |
| 2621 | idetape_pc_t pc; | 2584 | struct ide_atapi_pc pc; |
| 2622 | idetape_tape_t *tape; | 2585 | idetape_tape_t *tape; |
| 2623 | tape = drive->driver_data; | 2586 | tape = drive->driver_data; |
| 2624 | 2587 | ||
| @@ -2681,7 +2644,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, | |||
| 2681 | int mt_count) | 2644 | int mt_count) |
| 2682 | { | 2645 | { |
| 2683 | idetape_tape_t *tape = drive->driver_data; | 2646 | idetape_tape_t *tape = drive->driver_data; |
| 2684 | idetape_pc_t pc; | 2647 | struct ide_atapi_pc pc; |
| 2685 | unsigned long flags; | 2648 | unsigned long flags; |
| 2686 | int retval, count = 0; | 2649 | int retval, count = 0; |
| 2687 | int sprev = !!(tape->caps[4] & 0x20); | 2650 | int sprev = !!(tape->caps[4] & 0x20); |
| @@ -2697,12 +2660,13 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, | |||
| 2697 | if (tape->chrdev_dir == IDETAPE_DIR_READ) { | 2660 | if (tape->chrdev_dir == IDETAPE_DIR_READ) { |
| 2698 | /* its a read-ahead buffer, scan it for crossed filemarks. */ | 2661 | /* its a read-ahead buffer, scan it for crossed filemarks. */ |
| 2699 | tape->merge_stage_size = 0; | 2662 | tape->merge_stage_size = 0; |
| 2700 | if (test_and_clear_bit(IDETAPE_FILEMARK, &tape->flags)) | 2663 | if (test_and_clear_bit(IDETAPE_FLAG_FILEMARK, &tape->flags)) |
| 2701 | ++count; | 2664 | ++count; |
| 2702 | while (tape->first_stage != NULL) { | 2665 | while (tape->first_stage != NULL) { |
| 2703 | if (count == mt_count) { | 2666 | if (count == mt_count) { |
| 2704 | if (mt_op == MTFSFM) | 2667 | if (mt_op == MTFSFM) |
| 2705 | set_bit(IDETAPE_FILEMARK, &tape->flags); | 2668 | set_bit(IDETAPE_FLAG_FILEMARK, |
| 2669 | &tape->flags); | ||
| 2706 | return 0; | 2670 | return 0; |
| 2707 | } | 2671 | } |
| 2708 | spin_lock_irqsave(&tape->lock, flags); | 2672 | spin_lock_irqsave(&tape->lock, flags); |
| @@ -2786,7 +2750,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf, | |||
| 2786 | debug_log(DBG_CHRDEV, "Enter %s, count %Zd\n", __func__, count); | 2750 | debug_log(DBG_CHRDEV, "Enter %s, count %Zd\n", __func__, count); |
| 2787 | 2751 | ||
| 2788 | if (tape->chrdev_dir != IDETAPE_DIR_READ) { | 2752 | if (tape->chrdev_dir != IDETAPE_DIR_READ) { |
| 2789 | if (test_bit(IDETAPE_DETECT_BS, &tape->flags)) | 2753 | if (test_bit(IDETAPE_FLAG_DETECT_BS, &tape->flags)) |
| 2790 | if (count > tape->blk_size && | 2754 | if (count > tape->blk_size && |
| 2791 | (count % tape->blk_size) == 0) | 2755 | (count % tape->blk_size) == 0) |
| 2792 | tape->user_bs_factor = count / tape->blk_size; | 2756 | tape->user_bs_factor = count / tape->blk_size; |
| @@ -2829,7 +2793,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf, | |||
| 2829 | tape->merge_stage_size = bytes_read-temp; | 2793 | tape->merge_stage_size = bytes_read-temp; |
| 2830 | } | 2794 | } |
| 2831 | finish: | 2795 | finish: |
| 2832 | if (!actually_read && test_bit(IDETAPE_FILEMARK, &tape->flags)) { | 2796 | if (!actually_read && test_bit(IDETAPE_FLAG_FILEMARK, &tape->flags)) { |
| 2833 | debug_log(DBG_SENSE, "%s: spacing over filemark\n", tape->name); | 2797 | debug_log(DBG_SENSE, "%s: spacing over filemark\n", tape->name); |
| 2834 | 2798 | ||
| 2835 | idetape_space_over_filemarks(drive, MTFSF, 1); | 2799 | idetape_space_over_filemarks(drive, MTFSF, 1); |
| @@ -2938,7 +2902,7 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, | |||
| 2938 | 2902 | ||
| 2939 | static int idetape_write_filemark(ide_drive_t *drive) | 2903 | static int idetape_write_filemark(ide_drive_t *drive) |
| 2940 | { | 2904 | { |
| 2941 | idetape_pc_t pc; | 2905 | struct ide_atapi_pc pc; |
| 2942 | 2906 | ||
| 2943 | /* Write a filemark */ | 2907 | /* Write a filemark */ |
| 2944 | idetape_create_write_filemark_cmd(drive, &pc, 1); | 2908 | idetape_create_write_filemark_cmd(drive, &pc, 1); |
| @@ -2966,7 +2930,7 @@ static int idetape_write_filemark(ide_drive_t *drive) | |||
| 2966 | static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | 2930 | static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) |
| 2967 | { | 2931 | { |
| 2968 | idetape_tape_t *tape = drive->driver_data; | 2932 | idetape_tape_t *tape = drive->driver_data; |
| 2969 | idetape_pc_t pc; | 2933 | struct ide_atapi_pc pc; |
| 2970 | int i, retval; | 2934 | int i, retval; |
| 2971 | 2935 | ||
| 2972 | debug_log(DBG_ERR, "Handling MTIOCTOP ioctl: mt_op=%d, mt_count=%d\n", | 2936 | debug_log(DBG_ERR, "Handling MTIOCTOP ioctl: mt_op=%d, mt_count=%d\n", |
| @@ -3022,7 +2986,7 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | |||
| 3022 | !IDETAPE_LU_LOAD_MASK); | 2986 | !IDETAPE_LU_LOAD_MASK); |
| 3023 | retval = idetape_queue_pc_tail(drive, &pc); | 2987 | retval = idetape_queue_pc_tail(drive, &pc); |
| 3024 | if (!retval) | 2988 | if (!retval) |
| 3025 | clear_bit(IDETAPE_MEDIUM_PRESENT, &tape->flags); | 2989 | clear_bit(IDETAPE_FLAG_MEDIUM_PRESENT, &tape->flags); |
| 3026 | return retval; | 2990 | return retval; |
| 3027 | case MTNOP: | 2991 | case MTNOP: |
| 3028 | idetape_discard_read_pipeline(drive, 0); | 2992 | idetape_discard_read_pipeline(drive, 0); |
| @@ -3045,9 +3009,9 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | |||
| 3045 | mt_count % tape->blk_size) | 3009 | mt_count % tape->blk_size) |
| 3046 | return -EIO; | 3010 | return -EIO; |
| 3047 | tape->user_bs_factor = mt_count / tape->blk_size; | 3011 | tape->user_bs_factor = mt_count / tape->blk_size; |
| 3048 | clear_bit(IDETAPE_DETECT_BS, &tape->flags); | 3012 | clear_bit(IDETAPE_FLAG_DETECT_BS, &tape->flags); |
| 3049 | } else | 3013 | } else |
| 3050 | set_bit(IDETAPE_DETECT_BS, &tape->flags); | 3014 | set_bit(IDETAPE_FLAG_DETECT_BS, &tape->flags); |
| 3051 | return 0; | 3015 | return 0; |
| 3052 | case MTSEEK: | 3016 | case MTSEEK: |
| 3053 | idetape_discard_read_pipeline(drive, 0); | 3017 | idetape_discard_read_pipeline(drive, 0); |
| @@ -3149,7 +3113,7 @@ static int idetape_chrdev_ioctl(struct inode *inode, struct file *file, | |||
| 3149 | static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) | 3113 | static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) |
| 3150 | { | 3114 | { |
| 3151 | idetape_tape_t *tape = drive->driver_data; | 3115 | idetape_tape_t *tape = drive->driver_data; |
| 3152 | idetape_pc_t pc; | 3116 | struct ide_atapi_pc pc; |
| 3153 | 3117 | ||
| 3154 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); | 3118 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); |
| 3155 | if (idetape_queue_pc_tail(drive, &pc)) { | 3119 | if (idetape_queue_pc_tail(drive, &pc)) { |
| @@ -3161,10 +3125,10 @@ static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) | |||
| 3161 | } | 3125 | } |
| 3162 | return; | 3126 | return; |
| 3163 | } | 3127 | } |
| 3164 | tape->blk_size = (pc.buffer[4 + 5] << 16) + | 3128 | tape->blk_size = (pc.buf[4 + 5] << 16) + |
| 3165 | (pc.buffer[4 + 6] << 8) + | 3129 | (pc.buf[4 + 6] << 8) + |
| 3166 | pc.buffer[4 + 7]; | 3130 | pc.buf[4 + 7]; |
| 3167 | tape->drv_write_prot = (pc.buffer[2] & 0x80) >> 7; | 3131 | tape->drv_write_prot = (pc.buf[2] & 0x80) >> 7; |
| 3168 | } | 3132 | } |
| 3169 | 3133 | ||
| 3170 | static int idetape_chrdev_open(struct inode *inode, struct file *filp) | 3134 | static int idetape_chrdev_open(struct inode *inode, struct file *filp) |
| @@ -3172,7 +3136,7 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp) | |||
| 3172 | unsigned int minor = iminor(inode), i = minor & ~0xc0; | 3136 | unsigned int minor = iminor(inode), i = minor & ~0xc0; |
| 3173 | ide_drive_t *drive; | 3137 | ide_drive_t *drive; |
| 3174 | idetape_tape_t *tape; | 3138 | idetape_tape_t *tape; |
| 3175 | idetape_pc_t pc; | 3139 | struct ide_atapi_pc pc; |
| 3176 | int retval; | 3140 | int retval; |
| 3177 | 3141 | ||
| 3178 | if (i >= MAX_HWIFS * MAX_DRIVES) | 3142 | if (i >= MAX_HWIFS * MAX_DRIVES) |
| @@ -3195,24 +3159,24 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp) | |||
| 3195 | 3159 | ||
| 3196 | filp->private_data = tape; | 3160 | filp->private_data = tape; |
| 3197 | 3161 | ||
| 3198 | if (test_and_set_bit(IDETAPE_BUSY, &tape->flags)) { | 3162 | if (test_and_set_bit(IDETAPE_FLAG_BUSY, &tape->flags)) { |
| 3199 | retval = -EBUSY; | 3163 | retval = -EBUSY; |
| 3200 | goto out_put_tape; | 3164 | goto out_put_tape; |
| 3201 | } | 3165 | } |
| 3202 | 3166 | ||
| 3203 | retval = idetape_wait_ready(drive, 60 * HZ); | 3167 | retval = idetape_wait_ready(drive, 60 * HZ); |
| 3204 | if (retval) { | 3168 | if (retval) { |
| 3205 | clear_bit(IDETAPE_BUSY, &tape->flags); | 3169 | clear_bit(IDETAPE_FLAG_BUSY, &tape->flags); |
| 3206 | printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name); | 3170 | printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name); |
| 3207 | goto out_put_tape; | 3171 | goto out_put_tape; |
| 3208 | } | 3172 | } |
| 3209 | 3173 | ||
| 3210 | idetape_read_position(drive); | 3174 | idetape_read_position(drive); |
| 3211 | if (!test_bit(IDETAPE_ADDRESS_VALID, &tape->flags)) | 3175 | if (!test_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags)) |
| 3212 | (void)idetape_rewind_tape(drive); | 3176 | (void)idetape_rewind_tape(drive); |
| 3213 | 3177 | ||
| 3214 | if (tape->chrdev_dir != IDETAPE_DIR_READ) | 3178 | if (tape->chrdev_dir != IDETAPE_DIR_READ) |
| 3215 | clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | 3179 | clear_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags); |
| 3216 | 3180 | ||
| 3217 | /* Read block size and write protect status from drive. */ | 3181 | /* Read block size and write protect status from drive. */ |
| 3218 | ide_tape_get_bsize_from_bdesc(drive); | 3182 | ide_tape_get_bsize_from_bdesc(drive); |
| @@ -3227,7 +3191,7 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp) | |||
| 3227 | if (tape->write_prot) { | 3191 | if (tape->write_prot) { |
| 3228 | if ((filp->f_flags & O_ACCMODE) == O_WRONLY || | 3192 | if ((filp->f_flags & O_ACCMODE) == O_WRONLY || |
| 3229 | (filp->f_flags & O_ACCMODE) == O_RDWR) { | 3193 | (filp->f_flags & O_ACCMODE) == O_RDWR) { |
| 3230 | clear_bit(IDETAPE_BUSY, &tape->flags); | 3194 | clear_bit(IDETAPE_FLAG_BUSY, &tape->flags); |
| 3231 | retval = -EROFS; | 3195 | retval = -EROFS; |
| 3232 | goto out_put_tape; | 3196 | goto out_put_tape; |
| 3233 | } | 3197 | } |
| @@ -3272,7 +3236,7 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp) | |||
| 3272 | { | 3236 | { |
| 3273 | struct ide_tape_obj *tape = ide_tape_f(filp); | 3237 | struct ide_tape_obj *tape = ide_tape_f(filp); |
| 3274 | ide_drive_t *drive = tape->drive; | 3238 | ide_drive_t *drive = tape->drive; |
| 3275 | idetape_pc_t pc; | 3239 | struct ide_atapi_pc pc; |
| 3276 | unsigned int minor = iminor(inode); | 3240 | unsigned int minor = iminor(inode); |
| 3277 | 3241 | ||
| 3278 | lock_kernel(); | 3242 | lock_kernel(); |
| @@ -3292,7 +3256,7 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp) | |||
| 3292 | __idetape_kfree_stage(tape->cache_stage); | 3256 | __idetape_kfree_stage(tape->cache_stage); |
| 3293 | tape->cache_stage = NULL; | 3257 | tape->cache_stage = NULL; |
| 3294 | } | 3258 | } |
| 3295 | if (minor < 128 && test_bit(IDETAPE_MEDIUM_PRESENT, &tape->flags)) | 3259 | if (minor < 128 && test_bit(IDETAPE_FLAG_MEDIUM_PRESENT, &tape->flags)) |
| 3296 | (void) idetape_rewind_tape(drive); | 3260 | (void) idetape_rewind_tape(drive); |
| 3297 | if (tape->chrdev_dir == IDETAPE_DIR_NONE) { | 3261 | if (tape->chrdev_dir == IDETAPE_DIR_NONE) { |
| 3298 | if (tape->door_locked == DOOR_LOCKED) { | 3262 | if (tape->door_locked == DOOR_LOCKED) { |
| @@ -3302,7 +3266,7 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp) | |||
| 3302 | } | 3266 | } |
| 3303 | } | 3267 | } |
| 3304 | } | 3268 | } |
| 3305 | clear_bit(IDETAPE_BUSY, &tape->flags); | 3269 | clear_bit(IDETAPE_FLAG_BUSY, &tape->flags); |
| 3306 | ide_tape_put(tape); | 3270 | ide_tape_put(tape); |
| 3307 | unlock_kernel(); | 3271 | unlock_kernel(); |
| 3308 | return 0; | 3272 | return 0; |
| @@ -3350,7 +3314,7 @@ static int idetape_identify_device(ide_drive_t *drive) | |||
| 3350 | static void idetape_get_inquiry_results(ide_drive_t *drive) | 3314 | static void idetape_get_inquiry_results(ide_drive_t *drive) |
| 3351 | { | 3315 | { |
| 3352 | idetape_tape_t *tape = drive->driver_data; | 3316 | idetape_tape_t *tape = drive->driver_data; |
| 3353 | idetape_pc_t pc; | 3317 | struct ide_atapi_pc pc; |
| 3354 | char fw_rev[6], vendor_id[10], product_id[18]; | 3318 | char fw_rev[6], vendor_id[10], product_id[18]; |
| 3355 | 3319 | ||
| 3356 | idetape_create_inquiry_cmd(&pc); | 3320 | idetape_create_inquiry_cmd(&pc); |
| @@ -3359,9 +3323,9 @@ static void idetape_get_inquiry_results(ide_drive_t *drive) | |||
| 3359 | tape->name); | 3323 | tape->name); |
| 3360 | return; | 3324 | return; |
| 3361 | } | 3325 | } |
| 3362 | memcpy(vendor_id, &pc.buffer[8], 8); | 3326 | memcpy(vendor_id, &pc.buf[8], 8); |
| 3363 | memcpy(product_id, &pc.buffer[16], 16); | 3327 | memcpy(product_id, &pc.buf[16], 16); |
| 3364 | memcpy(fw_rev, &pc.buffer[32], 4); | 3328 | memcpy(fw_rev, &pc.buf[32], 4); |
| 3365 | 3329 | ||
| 3366 | ide_fixstring(vendor_id, 10, 0); | 3330 | ide_fixstring(vendor_id, 10, 0); |
| 3367 | ide_fixstring(product_id, 18, 0); | 3331 | ide_fixstring(product_id, 18, 0); |
| @@ -3378,7 +3342,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive) | |||
| 3378 | static void idetape_get_mode_sense_results(ide_drive_t *drive) | 3342 | static void idetape_get_mode_sense_results(ide_drive_t *drive) |
| 3379 | { | 3343 | { |
| 3380 | idetape_tape_t *tape = drive->driver_data; | 3344 | idetape_tape_t *tape = drive->driver_data; |
| 3381 | idetape_pc_t pc; | 3345 | struct ide_atapi_pc pc; |
| 3382 | u8 *caps; | 3346 | u8 *caps; |
| 3383 | u8 speed, max_speed; | 3347 | u8 speed, max_speed; |
| 3384 | 3348 | ||
| @@ -3392,7 +3356,7 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive) | |||
| 3392 | put_unaligned(6*52, (u16 *)&tape->caps[16]); | 3356 | put_unaligned(6*52, (u16 *)&tape->caps[16]); |
| 3393 | return; | 3357 | return; |
| 3394 | } | 3358 | } |
| 3395 | caps = pc.buffer + 4 + pc.buffer[3]; | 3359 | caps = pc.buf + 4 + pc.buf[3]; |
| 3396 | 3360 | ||
| 3397 | /* convert to host order and save for later use */ | 3361 | /* convert to host order and save for later use */ |
| 3398 | speed = be16_to_cpu(*(u16 *)&caps[14]); | 3362 | speed = be16_to_cpu(*(u16 *)&caps[14]); |
| @@ -3506,7 +3470,7 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
| 3506 | 3470 | ||
| 3507 | /* Command packet DRQ type */ | 3471 | /* Command packet DRQ type */ |
| 3508 | if (((gcw[0] & 0x60) >> 5) == 1) | 3472 | if (((gcw[0] & 0x60) >> 5) == 1) |
| 3509 | set_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags); | 3473 | set_bit(IDETAPE_FLAG_DRQ_INTERRUPT, &tape->flags); |
| 3510 | 3474 | ||
| 3511 | tape->min_pipeline = 10; | 3475 | tape->min_pipeline = 10; |
| 3512 | tape->max_pipeline = 10; | 3476 | tape->max_pipeline = 10; |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 4c86a8d84b4c..155cc904f4eb 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
| @@ -59,32 +59,34 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | |||
| 59 | SELECT_MASK(drive, 0); | 59 | SELECT_MASK(drive, 0); |
| 60 | 60 | ||
| 61 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) | 61 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) |
| 62 | hwif->OUTW((tf->hob_data << 8) | tf->data, IDE_DATA_REG); | 62 | hwif->OUTW((tf->hob_data << 8) | tf->data, |
| 63 | hwif->io_ports[IDE_DATA_OFFSET]); | ||
| 63 | 64 | ||
| 64 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | 65 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) |
| 65 | hwif->OUTB(tf->hob_feature, IDE_FEATURE_REG); | 66 | hwif->OUTB(tf->hob_feature, hwif->io_ports[IDE_FEATURE_OFFSET]); |
| 66 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | 67 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) |
| 67 | hwif->OUTB(tf->hob_nsect, IDE_NSECTOR_REG); | 68 | hwif->OUTB(tf->hob_nsect, hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 68 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | 69 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) |
| 69 | hwif->OUTB(tf->hob_lbal, IDE_SECTOR_REG); | 70 | hwif->OUTB(tf->hob_lbal, hwif->io_ports[IDE_SECTOR_OFFSET]); |
| 70 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | 71 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) |
| 71 | hwif->OUTB(tf->hob_lbam, IDE_LCYL_REG); | 72 | hwif->OUTB(tf->hob_lbam, hwif->io_ports[IDE_LCYL_OFFSET]); |
| 72 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | 73 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) |
| 73 | hwif->OUTB(tf->hob_lbah, IDE_HCYL_REG); | 74 | hwif->OUTB(tf->hob_lbah, hwif->io_ports[IDE_HCYL_OFFSET]); |
| 74 | 75 | ||
| 75 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | 76 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) |
| 76 | hwif->OUTB(tf->feature, IDE_FEATURE_REG); | 77 | hwif->OUTB(tf->feature, hwif->io_ports[IDE_FEATURE_OFFSET]); |
| 77 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | 78 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) |
| 78 | hwif->OUTB(tf->nsect, IDE_NSECTOR_REG); | 79 | hwif->OUTB(tf->nsect, hwif->io_ports[IDE_NSECTOR_OFFSET]); |
| 79 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | 80 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) |
| 80 | hwif->OUTB(tf->lbal, IDE_SECTOR_REG); | 81 | hwif->OUTB(tf->lbal, hwif->io_ports[IDE_SECTOR_OFFSET]); |
| 81 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | 82 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) |
| 82 | hwif->OUTB(tf->lbam, IDE_LCYL_REG); | 83 | hwif->OUTB(tf->lbam, hwif->io_ports[IDE_LCYL_OFFSET]); |
| 83 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | 84 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) |
| 84 | hwif->OUTB(tf->lbah, IDE_HCYL_REG); | 85 | hwif->OUTB(tf->lbah, hwif->io_ports[IDE_HCYL_OFFSET]); |
| 85 | 86 | ||
| 86 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | 87 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) |
| 87 | hwif->OUTB((tf->device & HIHI) | drive->select.all, IDE_SELECT_REG); | 88 | hwif->OUTB((tf->device & HIHI) | drive->select.all, |
| 89 | hwif->io_ports[IDE_SELECT_OFFSET]); | ||
| 88 | } | 90 | } |
| 89 | 91 | ||
| 90 | int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) | 92 | int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) |
| @@ -152,7 +154,8 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
| 152 | switch (task->data_phase) { | 154 | switch (task->data_phase) { |
| 153 | case TASKFILE_MULTI_OUT: | 155 | case TASKFILE_MULTI_OUT: |
| 154 | case TASKFILE_OUT: | 156 | case TASKFILE_OUT: |
| 155 | hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG); | 157 | hwif->OUTBSYNC(drive, tf->command, |
| 158 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 156 | ndelay(400); /* FIXME */ | 159 | ndelay(400); /* FIXME */ |
| 157 | return pre_task_out_intr(drive, task->rq); | 160 | return pre_task_out_intr(drive, task->rq); |
| 158 | case TASKFILE_MULTI_IN: | 161 | case TASKFILE_MULTI_IN: |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index fc69fe2e3ec0..917c72dcd33d 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
| @@ -78,6 +78,8 @@ | |||
| 78 | /* default maximum number of failures */ | 78 | /* default maximum number of failures */ |
| 79 | #define IDE_DEFAULT_MAX_FAILURES 1 | 79 | #define IDE_DEFAULT_MAX_FAILURES 1 |
| 80 | 80 | ||
| 81 | struct class *ide_port_class; | ||
| 82 | |||
| 81 | static const u8 ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR, | 83 | static const u8 ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR, |
| 82 | IDE2_MAJOR, IDE3_MAJOR, | 84 | IDE2_MAJOR, IDE3_MAJOR, |
| 83 | IDE4_MAJOR, IDE5_MAJOR, | 85 | IDE4_MAJOR, IDE5_MAJOR, |
| @@ -90,10 +92,6 @@ static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */ | |||
| 90 | DEFINE_MUTEX(ide_cfg_mtx); | 92 | DEFINE_MUTEX(ide_cfg_mtx); |
| 91 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock); | 93 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock); |
| 92 | 94 | ||
| 93 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | ||
| 94 | int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ | ||
| 95 | #endif | ||
| 96 | |||
| 97 | int noautodma = 0; | 95 | int noautodma = 0; |
| 98 | 96 | ||
| 99 | #ifdef CONFIG_BLK_DEV_IDEACPI | 97 | #ifdef CONFIG_BLK_DEV_IDEACPI |
| @@ -109,13 +107,13 @@ ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */ | |||
| 109 | 107 | ||
| 110 | EXPORT_SYMBOL(ide_hwifs); | 108 | EXPORT_SYMBOL(ide_hwifs); |
| 111 | 109 | ||
| 110 | static void ide_port_init_devices_data(ide_hwif_t *); | ||
| 111 | |||
| 112 | /* | 112 | /* |
| 113 | * Do not even *think* about calling this! | 113 | * Do not even *think* about calling this! |
| 114 | */ | 114 | */ |
| 115 | void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) | 115 | void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) |
| 116 | { | 116 | { |
| 117 | unsigned int unit; | ||
| 118 | |||
| 119 | /* bulk initialize hwif & drive info with zeros */ | 117 | /* bulk initialize hwif & drive info with zeros */ |
| 120 | memset(hwif, 0, sizeof(ide_hwif_t)); | 118 | memset(hwif, 0, sizeof(ide_hwif_t)); |
| 121 | 119 | ||
| @@ -134,8 +132,20 @@ void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) | |||
| 134 | 132 | ||
| 135 | default_hwif_iops(hwif); | 133 | default_hwif_iops(hwif); |
| 136 | default_hwif_transport(hwif); | 134 | default_hwif_transport(hwif); |
| 135 | |||
| 136 | ide_port_init_devices_data(hwif); | ||
| 137 | } | ||
| 138 | EXPORT_SYMBOL_GPL(ide_init_port_data); | ||
| 139 | |||
| 140 | static void ide_port_init_devices_data(ide_hwif_t *hwif) | ||
| 141 | { | ||
| 142 | int unit; | ||
| 143 | |||
| 137 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 144 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
| 138 | ide_drive_t *drive = &hwif->drives[unit]; | 145 | ide_drive_t *drive = &hwif->drives[unit]; |
| 146 | u8 j = (hwif->index * MAX_DRIVES) + unit; | ||
| 147 | |||
| 148 | memset(drive, 0, sizeof(*drive)); | ||
| 139 | 149 | ||
| 140 | drive->media = ide_disk; | 150 | drive->media = ide_disk; |
| 141 | drive->select.all = (unit<<4)|0xa0; | 151 | drive->select.all = (unit<<4)|0xa0; |
| @@ -147,32 +157,13 @@ void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) | |||
| 147 | drive->special.b.set_geometry = 1; | 157 | drive->special.b.set_geometry = 1; |
| 148 | drive->name[0] = 'h'; | 158 | drive->name[0] = 'h'; |
| 149 | drive->name[1] = 'd'; | 159 | drive->name[1] = 'd'; |
| 150 | drive->name[2] = 'a' + (index * MAX_DRIVES) + unit; | 160 | drive->name[2] = 'a' + j; |
| 151 | drive->max_failures = IDE_DEFAULT_MAX_FAILURES; | 161 | drive->max_failures = IDE_DEFAULT_MAX_FAILURES; |
| 152 | drive->using_dma = 0; | 162 | |
| 153 | drive->vdma = 0; | ||
| 154 | INIT_LIST_HEAD(&drive->list); | 163 | INIT_LIST_HEAD(&drive->list); |
| 155 | init_completion(&drive->gendev_rel_comp); | 164 | init_completion(&drive->gendev_rel_comp); |
| 156 | } | 165 | } |
| 157 | } | 166 | } |
| 158 | EXPORT_SYMBOL_GPL(ide_init_port_data); | ||
| 159 | |||
| 160 | static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) | ||
| 161 | { | ||
| 162 | hw_regs_t hw; | ||
| 163 | |||
| 164 | memset(&hw, 0, sizeof(hw_regs_t)); | ||
| 165 | |||
| 166 | ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq); | ||
| 167 | |||
| 168 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports)); | ||
| 169 | |||
| 170 | hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; | ||
| 171 | #ifdef CONFIG_BLK_DEV_HD | ||
| 172 | if (hwif->io_ports[IDE_DATA_OFFSET] == HD_DATA) | ||
| 173 | hwif->noprobe = 1; /* may be overridden by ide_setup() */ | ||
| 174 | #endif | ||
| 175 | } | ||
| 176 | 167 | ||
| 177 | /* | 168 | /* |
| 178 | * init_ide_data() sets reasonable default values into all fields | 169 | * init_ide_data() sets reasonable default values into all fields |
| @@ -194,7 +185,6 @@ static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) | |||
| 194 | #define MAGIC_COOKIE 0x12345678 | 185 | #define MAGIC_COOKIE 0x12345678 |
| 195 | static void __init init_ide_data (void) | 186 | static void __init init_ide_data (void) |
| 196 | { | 187 | { |
| 197 | ide_hwif_t *hwif; | ||
| 198 | unsigned int index; | 188 | unsigned int index; |
| 199 | static unsigned long magic_cookie = MAGIC_COOKIE; | 189 | static unsigned long magic_cookie = MAGIC_COOKIE; |
| 200 | 190 | ||
| @@ -204,13 +194,9 @@ static void __init init_ide_data (void) | |||
| 204 | 194 | ||
| 205 | /* Initialise all interface structures */ | 195 | /* Initialise all interface structures */ |
| 206 | for (index = 0; index < MAX_HWIFS; ++index) { | 196 | for (index = 0; index < MAX_HWIFS; ++index) { |
| 207 | hwif = &ide_hwifs[index]; | 197 | ide_hwif_t *hwif = &ide_hwifs[index]; |
| 198 | |||
| 208 | ide_init_port_data(hwif, index); | 199 | ide_init_port_data(hwif, index); |
| 209 | init_hwif_default(hwif, index); | ||
| 210 | #if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) | ||
| 211 | hwif->irq = | ||
| 212 | ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); | ||
| 213 | #endif | ||
| 214 | } | 200 | } |
| 215 | } | 201 | } |
| 216 | 202 | ||
| @@ -259,7 +245,7 @@ ide_hwif_t * ide_find_port(unsigned long base) | |||
| 259 | 245 | ||
| 260 | for (i = 0; i < MAX_HWIFS; i++) { | 246 | for (i = 0; i < MAX_HWIFS; i++) { |
| 261 | hwif = &ide_hwifs[i]; | 247 | hwif = &ide_hwifs[i]; |
| 262 | if (hwif->io_ports[IDE_DATA_OFFSET] == 0) | 248 | if (hwif->chipset == ide_unknown) |
| 263 | goto found; | 249 | goto found; |
| 264 | } | 250 | } |
| 265 | 251 | ||
| @@ -357,108 +343,6 @@ void ide_hwif_release_regions(ide_hwif_t *hwif) | |||
| 357 | release_region(hwif->io_ports[i], 1); | 343 | release_region(hwif->io_ports[i], 1); |
| 358 | } | 344 | } |
| 359 | 345 | ||
| 360 | /** | ||
| 361 | * ide_hwif_restore - restore hwif to template | ||
| 362 | * @hwif: hwif to update | ||
| 363 | * @tmp_hwif: template | ||
| 364 | * | ||
| 365 | * Restore hwif to a previous state by copying most settings | ||
| 366 | * from the template. | ||
| 367 | */ | ||
| 368 | |||
| 369 | static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) | ||
| 370 | { | ||
| 371 | hwif->hwgroup = tmp_hwif->hwgroup; | ||
| 372 | |||
| 373 | hwif->gendev.parent = tmp_hwif->gendev.parent; | ||
| 374 | |||
| 375 | hwif->proc = tmp_hwif->proc; | ||
| 376 | |||
| 377 | hwif->major = tmp_hwif->major; | ||
| 378 | hwif->straight8 = tmp_hwif->straight8; | ||
| 379 | hwif->bus_state = tmp_hwif->bus_state; | ||
| 380 | |||
| 381 | hwif->host_flags = tmp_hwif->host_flags; | ||
| 382 | |||
| 383 | hwif->pio_mask = tmp_hwif->pio_mask; | ||
| 384 | |||
| 385 | hwif->ultra_mask = tmp_hwif->ultra_mask; | ||
| 386 | hwif->mwdma_mask = tmp_hwif->mwdma_mask; | ||
| 387 | hwif->swdma_mask = tmp_hwif->swdma_mask; | ||
| 388 | |||
| 389 | hwif->cbl = tmp_hwif->cbl; | ||
| 390 | |||
| 391 | hwif->chipset = tmp_hwif->chipset; | ||
| 392 | hwif->hold = tmp_hwif->hold; | ||
| 393 | |||
| 394 | hwif->dev = tmp_hwif->dev; | ||
| 395 | |||
| 396 | #ifdef CONFIG_BLK_DEV_IDEPCI | ||
| 397 | hwif->cds = tmp_hwif->cds; | ||
| 398 | #endif | ||
| 399 | |||
| 400 | hwif->set_pio_mode = tmp_hwif->set_pio_mode; | ||
| 401 | hwif->set_dma_mode = tmp_hwif->set_dma_mode; | ||
| 402 | hwif->mdma_filter = tmp_hwif->mdma_filter; | ||
| 403 | hwif->udma_filter = tmp_hwif->udma_filter; | ||
| 404 | hwif->selectproc = tmp_hwif->selectproc; | ||
| 405 | hwif->reset_poll = tmp_hwif->reset_poll; | ||
| 406 | hwif->pre_reset = tmp_hwif->pre_reset; | ||
| 407 | hwif->resetproc = tmp_hwif->resetproc; | ||
| 408 | hwif->maskproc = tmp_hwif->maskproc; | ||
| 409 | hwif->quirkproc = tmp_hwif->quirkproc; | ||
| 410 | hwif->busproc = tmp_hwif->busproc; | ||
| 411 | |||
| 412 | hwif->ata_input_data = tmp_hwif->ata_input_data; | ||
| 413 | hwif->ata_output_data = tmp_hwif->ata_output_data; | ||
| 414 | hwif->atapi_input_bytes = tmp_hwif->atapi_input_bytes; | ||
| 415 | hwif->atapi_output_bytes = tmp_hwif->atapi_output_bytes; | ||
| 416 | |||
| 417 | hwif->dma_host_set = tmp_hwif->dma_host_set; | ||
| 418 | hwif->dma_setup = tmp_hwif->dma_setup; | ||
| 419 | hwif->dma_exec_cmd = tmp_hwif->dma_exec_cmd; | ||
| 420 | hwif->dma_start = tmp_hwif->dma_start; | ||
| 421 | hwif->ide_dma_end = tmp_hwif->ide_dma_end; | ||
| 422 | hwif->ide_dma_test_irq = tmp_hwif->ide_dma_test_irq; | ||
| 423 | hwif->ide_dma_clear_irq = tmp_hwif->ide_dma_clear_irq; | ||
| 424 | hwif->dma_lost_irq = tmp_hwif->dma_lost_irq; | ||
| 425 | hwif->dma_timeout = tmp_hwif->dma_timeout; | ||
| 426 | |||
| 427 | hwif->OUTB = tmp_hwif->OUTB; | ||
| 428 | hwif->OUTBSYNC = tmp_hwif->OUTBSYNC; | ||
| 429 | hwif->OUTW = tmp_hwif->OUTW; | ||
| 430 | hwif->OUTSW = tmp_hwif->OUTSW; | ||
| 431 | hwif->OUTSL = tmp_hwif->OUTSL; | ||
| 432 | |||
| 433 | hwif->INB = tmp_hwif->INB; | ||
| 434 | hwif->INW = tmp_hwif->INW; | ||
| 435 | hwif->INSW = tmp_hwif->INSW; | ||
| 436 | hwif->INSL = tmp_hwif->INSL; | ||
| 437 | |||
| 438 | hwif->sg_max_nents = tmp_hwif->sg_max_nents; | ||
| 439 | |||
| 440 | hwif->mmio = tmp_hwif->mmio; | ||
| 441 | hwif->rqsize = tmp_hwif->rqsize; | ||
| 442 | |||
| 443 | #ifndef CONFIG_BLK_DEV_IDECS | ||
| 444 | hwif->irq = tmp_hwif->irq; | ||
| 445 | #endif | ||
| 446 | |||
| 447 | hwif->dma_base = tmp_hwif->dma_base; | ||
| 448 | hwif->dma_command = tmp_hwif->dma_command; | ||
| 449 | hwif->dma_vendor1 = tmp_hwif->dma_vendor1; | ||
| 450 | hwif->dma_status = tmp_hwif->dma_status; | ||
| 451 | hwif->dma_vendor3 = tmp_hwif->dma_vendor3; | ||
| 452 | hwif->dma_prdtable = tmp_hwif->dma_prdtable; | ||
| 453 | |||
| 454 | hwif->config_data = tmp_hwif->config_data; | ||
| 455 | hwif->select_data = tmp_hwif->select_data; | ||
| 456 | hwif->extra_base = tmp_hwif->extra_base; | ||
| 457 | hwif->extra_ports = tmp_hwif->extra_ports; | ||
| 458 | |||
| 459 | hwif->hwif_data = tmp_hwif->hwif_data; | ||
| 460 | } | ||
| 461 | |||
| 462 | void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | 346 | void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) |
| 463 | { | 347 | { |
| 464 | ide_hwgroup_t *hwgroup = hwif->hwgroup; | 348 | ide_hwgroup_t *hwgroup = hwif->hwgroup; |
| @@ -494,11 +378,38 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | |||
| 494 | spin_unlock_irq(&ide_lock); | 378 | spin_unlock_irq(&ide_lock); |
| 495 | } | 379 | } |
| 496 | 380 | ||
| 381 | /* Called with ide_lock held. */ | ||
| 382 | static void __ide_port_unregister_devices(ide_hwif_t *hwif) | ||
| 383 | { | ||
| 384 | int i; | ||
| 385 | |||
| 386 | for (i = 0; i < MAX_DRIVES; i++) { | ||
| 387 | ide_drive_t *drive = &hwif->drives[i]; | ||
| 388 | |||
| 389 | if (drive->present) { | ||
| 390 | spin_unlock_irq(&ide_lock); | ||
| 391 | device_unregister(&drive->gendev); | ||
| 392 | wait_for_completion(&drive->gendev_rel_comp); | ||
| 393 | spin_lock_irq(&ide_lock); | ||
| 394 | } | ||
| 395 | } | ||
| 396 | } | ||
| 397 | |||
| 398 | void ide_port_unregister_devices(ide_hwif_t *hwif) | ||
| 399 | { | ||
| 400 | mutex_lock(&ide_cfg_mtx); | ||
| 401 | spin_lock_irq(&ide_lock); | ||
| 402 | __ide_port_unregister_devices(hwif); | ||
| 403 | hwif->present = 0; | ||
| 404 | ide_port_init_devices_data(hwif); | ||
| 405 | spin_unlock_irq(&ide_lock); | ||
| 406 | mutex_unlock(&ide_cfg_mtx); | ||
| 407 | } | ||
| 408 | EXPORT_SYMBOL_GPL(ide_port_unregister_devices); | ||
| 409 | |||
| 497 | /** | 410 | /** |
| 498 | * ide_unregister - free an IDE interface | 411 | * ide_unregister - free an IDE interface |
| 499 | * @index: index of interface (will change soon to a pointer) | 412 | * @index: index of interface (will change soon to a pointer) |
| 500 | * @init_default: init default hwif flag | ||
| 501 | * @restore: restore hwif flag | ||
| 502 | * | 413 | * |
| 503 | * Perform the final unregister of an IDE interface. At the moment | 414 | * Perform the final unregister of an IDE interface. At the moment |
| 504 | * we don't refcount interfaces so this will also get split up. | 415 | * we don't refcount interfaces so this will also get split up. |
| @@ -518,13 +429,11 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | |||
| 518 | * This is raving bonkers. | 429 | * This is raving bonkers. |
| 519 | */ | 430 | */ |
| 520 | 431 | ||
| 521 | void ide_unregister(unsigned int index, int init_default, int restore) | 432 | void ide_unregister(unsigned int index) |
| 522 | { | 433 | { |
| 523 | ide_drive_t *drive; | ||
| 524 | ide_hwif_t *hwif, *g; | 434 | ide_hwif_t *hwif, *g; |
| 525 | static ide_hwif_t tmp_hwif; /* protected by ide_cfg_mtx */ | ||
| 526 | ide_hwgroup_t *hwgroup; | 435 | ide_hwgroup_t *hwgroup; |
| 527 | int irq_count = 0, unit; | 436 | int irq_count = 0; |
| 528 | 437 | ||
| 529 | BUG_ON(index >= MAX_HWIFS); | 438 | BUG_ON(index >= MAX_HWIFS); |
| 530 | 439 | ||
| @@ -535,15 +444,7 @@ void ide_unregister(unsigned int index, int init_default, int restore) | |||
| 535 | hwif = &ide_hwifs[index]; | 444 | hwif = &ide_hwifs[index]; |
| 536 | if (!hwif->present) | 445 | if (!hwif->present) |
| 537 | goto abort; | 446 | goto abort; |
| 538 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 447 | __ide_port_unregister_devices(hwif); |
| 539 | drive = &hwif->drives[unit]; | ||
| 540 | if (!drive->present) | ||
| 541 | continue; | ||
| 542 | spin_unlock_irq(&ide_lock); | ||
| 543 | device_unregister(&drive->gendev); | ||
| 544 | wait_for_completion(&drive->gendev_rel_comp); | ||
| 545 | spin_lock_irq(&ide_lock); | ||
| 546 | } | ||
| 547 | hwif->present = 0; | 448 | hwif->present = 0; |
| 548 | 449 | ||
| 549 | spin_unlock_irq(&ide_lock); | 450 | spin_unlock_irq(&ide_lock); |
| @@ -565,6 +466,7 @@ void ide_unregister(unsigned int index, int init_default, int restore) | |||
| 565 | 466 | ||
| 566 | ide_remove_port_from_hwgroup(hwif); | 467 | ide_remove_port_from_hwgroup(hwif); |
| 567 | 468 | ||
| 469 | device_unregister(hwif->portdev); | ||
| 568 | device_unregister(&hwif->gendev); | 470 | device_unregister(&hwif->gendev); |
| 569 | wait_for_completion(&hwif->gendev_rel_comp); | 471 | wait_for_completion(&hwif->gendev_rel_comp); |
| 570 | 472 | ||
| @@ -576,34 +478,14 @@ void ide_unregister(unsigned int index, int init_default, int restore) | |||
| 576 | unregister_blkdev(hwif->major, hwif->name); | 478 | unregister_blkdev(hwif->major, hwif->name); |
| 577 | spin_lock_irq(&ide_lock); | 479 | spin_lock_irq(&ide_lock); |
| 578 | 480 | ||
| 579 | if (hwif->dma_base) { | 481 | if (hwif->dma_base) |
| 580 | (void) ide_release_dma(hwif); | 482 | (void)ide_release_dma(hwif); |
| 581 | |||
| 582 | hwif->dma_base = 0; | ||
| 583 | hwif->dma_command = 0; | ||
| 584 | hwif->dma_vendor1 = 0; | ||
| 585 | hwif->dma_status = 0; | ||
| 586 | hwif->dma_vendor3 = 0; | ||
| 587 | hwif->dma_prdtable = 0; | ||
| 588 | |||
| 589 | hwif->extra_base = 0; | ||
| 590 | hwif->extra_ports = 0; | ||
| 591 | } | ||
| 592 | 483 | ||
| 593 | ide_hwif_release_regions(hwif); | 484 | ide_hwif_release_regions(hwif); |
| 594 | 485 | ||
| 595 | /* copy original settings */ | ||
| 596 | tmp_hwif = *hwif; | ||
| 597 | |||
| 598 | /* restore hwif data to pristine status */ | 486 | /* restore hwif data to pristine status */ |
| 599 | ide_init_port_data(hwif, index); | 487 | ide_init_port_data(hwif, index); |
| 600 | 488 | ||
| 601 | if (init_default) | ||
| 602 | init_hwif_default(hwif, index); | ||
| 603 | |||
| 604 | if (restore) | ||
| 605 | ide_hwif_restore(hwif, &tmp_hwif); | ||
| 606 | |||
| 607 | abort: | 489 | abort: |
| 608 | spin_unlock_irq(&ide_lock); | 490 | spin_unlock_irq(&ide_lock); |
| 609 | mutex_unlock(&ide_cfg_mtx); | 491 | mutex_unlock(&ide_cfg_mtx); |
| @@ -622,79 +504,6 @@ void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) | |||
| 622 | } | 504 | } |
| 623 | EXPORT_SYMBOL_GPL(ide_init_port_hw); | 505 | EXPORT_SYMBOL_GPL(ide_init_port_hw); |
| 624 | 506 | ||
| 625 | ide_hwif_t *ide_deprecated_find_port(unsigned long base) | ||
| 626 | { | ||
| 627 | ide_hwif_t *hwif; | ||
| 628 | int i; | ||
| 629 | |||
| 630 | for (i = 0; i < MAX_HWIFS; i++) { | ||
| 631 | hwif = &ide_hwifs[i]; | ||
| 632 | if (hwif->io_ports[IDE_DATA_OFFSET] == base) | ||
| 633 | goto found; | ||
| 634 | } | ||
| 635 | |||
| 636 | for (i = 0; i < MAX_HWIFS; i++) { | ||
| 637 | hwif = &ide_hwifs[i]; | ||
| 638 | if (hwif->hold) | ||
| 639 | continue; | ||
| 640 | if (!hwif->present && hwif->mate == NULL) | ||
| 641 | goto found; | ||
| 642 | } | ||
| 643 | |||
| 644 | hwif = NULL; | ||
| 645 | found: | ||
| 646 | return hwif; | ||
| 647 | } | ||
| 648 | EXPORT_SYMBOL_GPL(ide_deprecated_find_port); | ||
| 649 | |||
| 650 | /** | ||
| 651 | * ide_register_hw - register IDE interface | ||
| 652 | * @hw: hardware registers | ||
| 653 | * @quirkproc: quirkproc function | ||
| 654 | * @hwifp: pointer to returned hwif | ||
| 655 | * | ||
| 656 | * Register an IDE interface, specifying exactly the registers etc. | ||
| 657 | * | ||
| 658 | * Returns -1 on error. | ||
| 659 | */ | ||
| 660 | |||
| 661 | int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), | ||
| 662 | ide_hwif_t **hwifp) | ||
| 663 | { | ||
| 664 | int index, retry = 1; | ||
| 665 | ide_hwif_t *hwif; | ||
| 666 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 667 | |||
| 668 | do { | ||
| 669 | hwif = ide_deprecated_find_port(hw->io_ports[IDE_DATA_OFFSET]); | ||
| 670 | if (hwif) | ||
| 671 | goto found; | ||
| 672 | for (index = 0; index < MAX_HWIFS; index++) | ||
| 673 | ide_unregister(index, 1, 1); | ||
| 674 | } while (retry--); | ||
| 675 | return -1; | ||
| 676 | found: | ||
| 677 | index = hwif->index; | ||
| 678 | if (hwif->present) | ||
| 679 | ide_unregister(index, 0, 1); | ||
| 680 | else if (!hwif->hold) | ||
| 681 | ide_init_port_data(hwif, index); | ||
| 682 | |||
| 683 | ide_init_port_hw(hwif, hw); | ||
| 684 | hwif->quirkproc = quirkproc; | ||
| 685 | |||
| 686 | idx[0] = index; | ||
| 687 | |||
| 688 | ide_device_add(idx, NULL); | ||
| 689 | |||
| 690 | if (hwifp) | ||
| 691 | *hwifp = hwif; | ||
| 692 | |||
| 693 | return hwif->present ? index : -1; | ||
| 694 | } | ||
| 695 | |||
| 696 | EXPORT_SYMBOL(ide_register_hw); | ||
| 697 | |||
| 698 | /* | 507 | /* |
| 699 | * Locks for IDE setting functionality | 508 | * Locks for IDE setting functionality |
| 700 | */ | 509 | */ |
| @@ -997,27 +806,6 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device | |||
| 997 | if (!capable(CAP_SYS_RAWIO)) | 806 | if (!capable(CAP_SYS_RAWIO)) |
| 998 | return -EACCES; | 807 | return -EACCES; |
| 999 | return ide_task_ioctl(drive, cmd, arg); | 808 | return ide_task_ioctl(drive, cmd, arg); |
| 1000 | |||
| 1001 | case HDIO_SCAN_HWIF: | ||
| 1002 | { | ||
| 1003 | hw_regs_t hw; | ||
| 1004 | int args[3]; | ||
| 1005 | if (!capable(CAP_SYS_RAWIO)) return -EACCES; | ||
| 1006 | if (copy_from_user(args, p, 3 * sizeof(int))) | ||
| 1007 | return -EFAULT; | ||
| 1008 | memset(&hw, 0, sizeof(hw)); | ||
| 1009 | ide_init_hwif_ports(&hw, (unsigned long) args[0], | ||
| 1010 | (unsigned long) args[1], NULL); | ||
| 1011 | hw.irq = args[2]; | ||
| 1012 | if (ide_register_hw(&hw, NULL, NULL) == -1) | ||
| 1013 | return -EIO; | ||
| 1014 | return 0; | ||
| 1015 | } | ||
| 1016 | case HDIO_UNREGISTER_HWIF: | ||
| 1017 | if (!capable(CAP_SYS_RAWIO)) return -EACCES; | ||
| 1018 | /* (arg > MAX_HWIFS) checked in function */ | ||
| 1019 | ide_unregister(arg, 1, 1); | ||
| 1020 | return 0; | ||
| 1021 | case HDIO_SET_NICE: | 809 | case HDIO_SET_NICE: |
| 1022 | if (!capable(CAP_SYS_ADMIN)) return -EACCES; | 810 | if (!capable(CAP_SYS_ADMIN)) return -EACCES; |
| 1023 | if (arg != (arg & ((1 << IDE_NICE_DSC_OVERLAP) | (1 << IDE_NICE_1)))) | 811 | if (arg != (arg & ((1 << IDE_NICE_DSC_OVERLAP) | (1 << IDE_NICE_1)))) |
| @@ -1071,8 +859,6 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device | |||
| 1071 | case HDIO_SET_BUSSTATE: | 859 | case HDIO_SET_BUSSTATE: |
| 1072 | if (!capable(CAP_SYS_ADMIN)) | 860 | if (!capable(CAP_SYS_ADMIN)) |
| 1073 | return -EACCES; | 861 | return -EACCES; |
| 1074 | if (HWIF(drive)->busproc) | ||
| 1075 | return HWIF(drive)->busproc(drive, (int)arg); | ||
| 1076 | return -EOPNOTSUPP; | 862 | return -EOPNOTSUPP; |
| 1077 | default: | 863 | default: |
| 1078 | return -EINVAL; | 864 | return -EINVAL; |
| @@ -1173,8 +959,9 @@ extern int probe_dtc2278; | |||
| 1173 | extern int probe_ht6560b; | 959 | extern int probe_ht6560b; |
| 1174 | extern int probe_qd65xx; | 960 | extern int probe_qd65xx; |
| 1175 | extern int cmd640_vlb; | 961 | extern int cmd640_vlb; |
| 962 | extern int probe_4drives; | ||
| 1176 | 963 | ||
| 1177 | static int __initdata is_chipset_set[MAX_HWIFS]; | 964 | static int __initdata is_chipset_set; |
| 1178 | 965 | ||
| 1179 | /* | 966 | /* |
| 1180 | * ide_setup() gets called VERY EARLY during initialization, | 967 | * ide_setup() gets called VERY EARLY during initialization, |
| @@ -1217,14 +1004,6 @@ static int __init ide_setup(char *s) | |||
| 1217 | goto obsolete_option; | 1004 | goto obsolete_option; |
| 1218 | } | 1005 | } |
| 1219 | 1006 | ||
| 1220 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | ||
| 1221 | if (!strcmp(s, "ide=reverse")) { | ||
| 1222 | ide_scan_direction = 1; | ||
| 1223 | printk(" : Enabled support for IDE inverse scan order.\n"); | ||
| 1224 | goto obsolete_option; | ||
| 1225 | } | ||
| 1226 | #endif | ||
| 1227 | |||
| 1228 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1007 | #ifdef CONFIG_BLK_DEV_IDEACPI |
| 1229 | if (!strcmp(s, "ide=noacpi")) { | 1008 | if (!strcmp(s, "ide=noacpi")) { |
| 1230 | //printk(" : Disable IDE ACPI support.\n"); | 1009 | //printk(" : Disable IDE ACPI support.\n"); |
| @@ -1335,13 +1114,11 @@ static int __init ide_setup(char *s) | |||
| 1335 | * (-8, -9, -10) are reserved to ease the hardcoding. | 1114 | * (-8, -9, -10) are reserved to ease the hardcoding. |
| 1336 | */ | 1115 | */ |
| 1337 | static const char *ide_words[] = { | 1116 | static const char *ide_words[] = { |
| 1338 | "noprobe", "serialize", "minus3", "minus4", | 1117 | "minus1", "serialize", "minus3", "minus4", |
| 1339 | "reset", "minus6", "ata66", "minus8", "minus9", | 1118 | "reset", "minus6", "ata66", "minus8", "minus9", |
| 1340 | "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", | 1119 | "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", |
| 1341 | "dtc2278", "umc8672", "ali14xx", NULL }; | 1120 | "dtc2278", "umc8672", "ali14xx", NULL }; |
| 1342 | 1121 | ||
| 1343 | hw_regs_t hwregs; | ||
| 1344 | |||
| 1345 | hw = s[3] - '0'; | 1122 | hw = s[3] - '0'; |
| 1346 | hwif = &ide_hwifs[hw]; | 1123 | hwif = &ide_hwifs[hw]; |
| 1347 | i = match_parm(&s[4], ide_words, vals, 3); | 1124 | i = match_parm(&s[4], ide_words, vals, 3); |
| @@ -1350,19 +1127,14 @@ static int __init ide_setup(char *s) | |||
| 1350 | * Cryptic check to ensure chipset not already set for hwif. | 1127 | * Cryptic check to ensure chipset not already set for hwif. |
| 1351 | * Note: we can't depend on hwif->chipset here. | 1128 | * Note: we can't depend on hwif->chipset here. |
| 1352 | */ | 1129 | */ |
| 1353 | if ((i >= -18 && i <= -11) || (i > 0 && i <= 3)) { | 1130 | if (i >= -18 && i <= -11) { |
| 1354 | /* chipset already specified */ | 1131 | /* chipset already specified */ |
| 1355 | if (is_chipset_set[hw]) | 1132 | if (is_chipset_set) |
| 1356 | goto bad_option; | 1133 | goto bad_option; |
| 1357 | if (i > -18 && i <= -11) { | 1134 | /* these drivers are for "ide0=" only */ |
| 1358 | /* these drivers are for "ide0=" only */ | 1135 | if (hw != 0) |
| 1359 | if (hw != 0) | 1136 | goto bad_hwif; |
| 1360 | goto bad_hwif; | 1137 | is_chipset_set = 1; |
| 1361 | /* chipset already specified for 2nd port */ | ||
| 1362 | if (is_chipset_set[hw+1]) | ||
| 1363 | goto bad_option; | ||
| 1364 | } | ||
| 1365 | is_chipset_set[hw] = 1; | ||
| 1366 | printk("\n"); | 1138 | printk("\n"); |
| 1367 | } | 1139 | } |
| 1368 | 1140 | ||
| @@ -1399,19 +1171,9 @@ static int __init ide_setup(char *s) | |||
| 1399 | #endif | 1171 | #endif |
| 1400 | #ifdef CONFIG_BLK_DEV_4DRIVES | 1172 | #ifdef CONFIG_BLK_DEV_4DRIVES |
| 1401 | case -11: /* "four" drives on one set of ports */ | 1173 | case -11: /* "four" drives on one set of ports */ |
| 1402 | { | 1174 | probe_4drives = 1; |
| 1403 | ide_hwif_t *mate = &ide_hwifs[hw^1]; | ||
| 1404 | mate->drives[0].select.all ^= 0x20; | ||
| 1405 | mate->drives[1].select.all ^= 0x20; | ||
| 1406 | hwif->chipset = mate->chipset = ide_4drives; | ||
| 1407 | mate->irq = hwif->irq; | ||
| 1408 | memcpy(mate->io_ports, hwif->io_ports, sizeof(hwif->io_ports)); | ||
| 1409 | hwif->mate = mate; | ||
| 1410 | mate->mate = hwif; | ||
| 1411 | hwif->serialized = mate->serialized = 1; | ||
| 1412 | goto obsolete_option; | 1175 | goto obsolete_option; |
| 1413 | } | 1176 | #endif |
| 1414 | #endif /* CONFIG_BLK_DEV_4DRIVES */ | ||
| 1415 | case -10: /* minus10 */ | 1177 | case -10: /* minus10 */ |
| 1416 | case -9: /* minus9 */ | 1178 | case -9: /* minus9 */ |
| 1417 | case -8: /* minus8 */ | 1179 | case -8: /* minus8 */ |
| @@ -1439,24 +1201,12 @@ static int __init ide_setup(char *s) | |||
| 1439 | hwif->serialized = hwif->mate->serialized = 1; | 1201 | hwif->serialized = hwif->mate->serialized = 1; |
| 1440 | goto obsolete_option; | 1202 | goto obsolete_option; |
| 1441 | 1203 | ||
| 1442 | case -1: /* "noprobe" */ | 1204 | case -1: |
| 1443 | hwif->noprobe = 1; | 1205 | case 0: |
| 1444 | goto obsolete_option; | 1206 | case 1: |
| 1445 | 1207 | case 2: | |
| 1446 | case 1: /* base */ | 1208 | case 3: |
| 1447 | vals[1] = vals[0] + 0x206; /* default ctl */ | 1209 | goto bad_option; |
| 1448 | case 2: /* base,ctl */ | ||
| 1449 | vals[2] = 0; /* default irq = probe for it */ | ||
| 1450 | case 3: /* base,ctl,irq */ | ||
| 1451 | memset(&hwregs, 0, sizeof(hwregs)); | ||
| 1452 | ide_init_hwif_ports(&hwregs, vals[0], vals[1], &hwif->irq); | ||
| 1453 | memcpy(hwif->io_ports, hwregs.io_ports, sizeof(hwif->io_ports)); | ||
| 1454 | hwif->irq = vals[2]; | ||
| 1455 | hwif->noprobe = 0; | ||
| 1456 | hwif->chipset = ide_forced; | ||
| 1457 | goto obsolete_option; | ||
| 1458 | |||
| 1459 | case 0: goto bad_option; | ||
| 1460 | default: | 1210 | default: |
| 1461 | printk(" -- SUPPORT NOT CONFIGURED IN THIS KERNEL\n"); | 1211 | printk(" -- SUPPORT NOT CONFIGURED IN THIS KERNEL\n"); |
| 1462 | return 1; | 1212 | return 1; |
| @@ -1601,6 +1351,13 @@ struct bus_type ide_bus_type = { | |||
| 1601 | 1351 | ||
| 1602 | EXPORT_SYMBOL_GPL(ide_bus_type); | 1352 | EXPORT_SYMBOL_GPL(ide_bus_type); |
| 1603 | 1353 | ||
| 1354 | static void ide_port_class_release(struct device *portdev) | ||
| 1355 | { | ||
| 1356 | ide_hwif_t *hwif = dev_get_drvdata(portdev); | ||
| 1357 | |||
| 1358 | put_device(&hwif->gendev); | ||
| 1359 | } | ||
| 1360 | |||
| 1604 | /* | 1361 | /* |
| 1605 | * This is gets invoked once during initialization, to set *everything* up | 1362 | * This is gets invoked once during initialization, to set *everything* up |
| 1606 | */ | 1363 | */ |
| @@ -1621,11 +1378,23 @@ static int __init ide_init(void) | |||
| 1621 | return ret; | 1378 | return ret; |
| 1622 | } | 1379 | } |
| 1623 | 1380 | ||
| 1381 | ide_port_class = class_create(THIS_MODULE, "ide_port"); | ||
| 1382 | if (IS_ERR(ide_port_class)) { | ||
| 1383 | ret = PTR_ERR(ide_port_class); | ||
| 1384 | goto out_port_class; | ||
| 1385 | } | ||
| 1386 | ide_port_class->dev_release = ide_port_class_release; | ||
| 1387 | |||
| 1624 | init_ide_data(); | 1388 | init_ide_data(); |
| 1625 | 1389 | ||
| 1626 | proc_ide_create(); | 1390 | proc_ide_create(); |
| 1627 | 1391 | ||
| 1628 | return 0; | 1392 | return 0; |
| 1393 | |||
| 1394 | out_port_class: | ||
| 1395 | bus_unregister(&ide_bus_type); | ||
| 1396 | |||
| 1397 | return ret; | ||
| 1629 | } | 1398 | } |
| 1630 | 1399 | ||
| 1631 | #ifdef MODULE | 1400 | #ifdef MODULE |
| @@ -1658,10 +1427,12 @@ void __exit cleanup_module (void) | |||
| 1658 | int index; | 1427 | int index; |
| 1659 | 1428 | ||
| 1660 | for (index = 0; index < MAX_HWIFS; ++index) | 1429 | for (index = 0; index < MAX_HWIFS; ++index) |
| 1661 | ide_unregister(index, 0, 0); | 1430 | ide_unregister(index); |
| 1662 | 1431 | ||
| 1663 | proc_ide_destroy(); | 1432 | proc_ide_destroy(); |
| 1664 | 1433 | ||
| 1434 | class_destroy(ide_port_class); | ||
| 1435 | |||
| 1665 | bus_unregister(&ide_bus_type); | 1436 | bus_unregister(&ide_bus_type); |
| 1666 | } | 1437 | } |
| 1667 | 1438 | ||
diff --git a/drivers/ide/legacy/Makefile b/drivers/ide/legacy/Makefile index 7043ec7d1e05..6939329f89e8 100644 --- a/drivers/ide/legacy/Makefile +++ b/drivers/ide/legacy/Makefile | |||
| @@ -6,6 +6,7 @@ obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o | |||
| 6 | obj-$(CONFIG_BLK_DEV_DTC2278) += dtc2278.o | 6 | obj-$(CONFIG_BLK_DEV_DTC2278) += dtc2278.o |
| 7 | obj-$(CONFIG_BLK_DEV_HT6560B) += ht6560b.o | 7 | obj-$(CONFIG_BLK_DEV_HT6560B) += ht6560b.o |
| 8 | obj-$(CONFIG_BLK_DEV_QD65XX) += qd65xx.o | 8 | obj-$(CONFIG_BLK_DEV_QD65XX) += qd65xx.o |
| 9 | obj-$(CONFIG_BLK_DEV_4DRIVES) += ide-4drives.o | ||
| 9 | 10 | ||
| 10 | obj-$(CONFIG_BLK_DEV_GAYLE) += gayle.o | 11 | obj-$(CONFIG_BLK_DEV_GAYLE) += gayle.o |
| 11 | obj-$(CONFIG_BLK_DEV_FALCON_IDE) += falconide.o | 12 | obj-$(CONFIG_BLK_DEV_FALCON_IDE) += falconide.o |
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index d4d1a6bea599..bc8b1f8de614 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
| @@ -200,6 +200,7 @@ static const struct ide_port_info ali14xx_port_info = { | |||
| 200 | static int __init ali14xx_probe(void) | 200 | static int __init ali14xx_probe(void) |
| 201 | { | 201 | { |
| 202 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | 202 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; |
| 203 | hw_regs_t hw[2]; | ||
| 203 | 204 | ||
| 204 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", | 205 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", |
| 205 | basePort, regOn); | 206 | basePort, regOn); |
| @@ -210,6 +211,17 @@ static int __init ali14xx_probe(void) | |||
| 210 | return 1; | 211 | return 1; |
| 211 | } | 212 | } |
| 212 | 213 | ||
| 214 | memset(&hw, 0, sizeof(hw)); | ||
| 215 | |||
| 216 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
| 217 | hw[0].irq = 14; | ||
| 218 | |||
| 219 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
| 220 | hw[1].irq = 15; | ||
| 221 | |||
| 222 | ide_init_port_hw(&ide_hwifs[0], &hw[0]); | ||
| 223 | ide_init_port_hw(&ide_hwifs[1], &hw[1]); | ||
| 224 | |||
| 213 | ide_hwifs[0].set_pio_mode = &ali14xx_set_pio_mode; | 225 | ide_hwifs[0].set_pio_mode = &ali14xx_set_pio_mode; |
| 214 | ide_hwifs[1].set_pio_mode = &ali14xx_set_pio_mode; | 226 | ide_hwifs[1].set_pio_mode = &ali14xx_set_pio_mode; |
| 215 | 227 | ||
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 73396f70f2b7..5f69cd2ea6f7 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c | |||
| @@ -103,6 +103,7 @@ static int __init dtc2278_probe(void) | |||
| 103 | unsigned long flags; | 103 | unsigned long flags; |
| 104 | ide_hwif_t *hwif, *mate; | 104 | ide_hwif_t *hwif, *mate; |
| 105 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | 105 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; |
| 106 | hw_regs_t hw[2]; | ||
| 106 | 107 | ||
| 107 | hwif = &ide_hwifs[0]; | 108 | hwif = &ide_hwifs[0]; |
| 108 | mate = &ide_hwifs[1]; | 109 | mate = &ide_hwifs[1]; |
| @@ -128,6 +129,17 @@ static int __init dtc2278_probe(void) | |||
| 128 | #endif | 129 | #endif |
| 129 | local_irq_restore(flags); | 130 | local_irq_restore(flags); |
| 130 | 131 | ||
| 132 | memset(&hw, 0, sizeof(hw)); | ||
| 133 | |||
| 134 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
| 135 | hw[0].irq = 14; | ||
| 136 | |||
| 137 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
| 138 | hw[1].irq = 15; | ||
| 139 | |||
| 140 | ide_init_port_hw(hwif, &hw[0]); | ||
| 141 | ide_init_port_hw(mate, &hw[1]); | ||
| 142 | |||
| 131 | hwif->set_pio_mode = &dtc2278_set_pio_mode; | 143 | hwif->set_pio_mode = &dtc2278_set_pio_mode; |
| 132 | 144 | ||
| 133 | ide_device_add(idx, &dtc2278_port_info); | 145 | ide_device_add(idx, &dtc2278_port_info); |
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 78ca68e60f97..88fe9070c9c3 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
| @@ -82,7 +82,7 @@ | |||
| 82 | * out how they setup those cycle time interfacing values, as they at Holtek | 82 | * out how they setup those cycle time interfacing values, as they at Holtek |
| 83 | * call them. IDESETUP.COM that is supplied with the drivers figures out | 83 | * call them. IDESETUP.COM that is supplied with the drivers figures out |
| 84 | * optimal values and fetches those values to drivers. I found out that | 84 | * optimal values and fetches those values to drivers. I found out that |
| 85 | * they use IDE_SELECT_REG to fetch timings to the ide board right after | 85 | * they use Select register to fetch timings to the ide board right after |
| 86 | * interface switching. After that it was quite easy to add code to | 86 | * interface switching. After that it was quite easy to add code to |
| 87 | * ht6560b.c. | 87 | * ht6560b.c. |
| 88 | * | 88 | * |
| @@ -127,6 +127,7 @@ | |||
| 127 | */ | 127 | */ |
| 128 | static void ht6560b_selectproc (ide_drive_t *drive) | 128 | static void ht6560b_selectproc (ide_drive_t *drive) |
| 129 | { | 129 | { |
| 130 | ide_hwif_t *hwif = drive->hwif; | ||
| 130 | unsigned long flags; | 131 | unsigned long flags; |
| 131 | static u8 current_select = 0; | 132 | static u8 current_select = 0; |
| 132 | static u8 current_timing = 0; | 133 | static u8 current_timing = 0; |
| @@ -155,8 +156,8 @@ static void ht6560b_selectproc (ide_drive_t *drive) | |||
| 155 | /* | 156 | /* |
| 156 | * Set timing for this drive: | 157 | * Set timing for this drive: |
| 157 | */ | 158 | */ |
| 158 | outb(timing, IDE_SELECT_REG); | 159 | outb(timing, hwif->io_ports[IDE_SELECT_OFFSET]); |
| 159 | (void)inb(IDE_STATUS_REG); | 160 | (void)inb(hwif->io_ports[IDE_STATUS_OFFSET]); |
| 160 | #ifdef DEBUG | 161 | #ifdef DEBUG |
| 161 | printk("ht6560b: %s: select=%#x timing=%#x\n", | 162 | printk("ht6560b: %s: select=%#x timing=%#x\n", |
| 162 | drive->name, select, timing); | 163 | drive->name, select, timing); |
| @@ -193,9 +194,9 @@ static int __init try_to_init_ht6560b(void) | |||
| 193 | * Ht6560b autodetected | 194 | * Ht6560b autodetected |
| 194 | */ | 195 | */ |
| 195 | outb(HT_CONFIG_DEFAULT, HT_CONFIG_PORT); | 196 | outb(HT_CONFIG_DEFAULT, HT_CONFIG_PORT); |
| 196 | outb(HT_TIMING_DEFAULT, 0x1f6); /* IDE_SELECT_REG */ | 197 | outb(HT_TIMING_DEFAULT, 0x1f6); /* Select register */ |
| 197 | (void) inb(0x1f7); /* IDE_STATUS_REG */ | 198 | (void)inb(0x1f7); /* Status register */ |
| 198 | 199 | ||
| 199 | printk("ht6560b " HT6560B_VERSION | 200 | printk("ht6560b " HT6560B_VERSION |
| 200 | ": chipset detected and initialized" | 201 | ": chipset detected and initialized" |
| 201 | #ifdef DEBUG | 202 | #ifdef DEBUG |
| @@ -339,6 +340,7 @@ static int __init ht6560b_init(void) | |||
| 339 | { | 340 | { |
| 340 | ide_hwif_t *hwif, *mate; | 341 | ide_hwif_t *hwif, *mate; |
| 341 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | 342 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; |
| 343 | hw_regs_t hw[2]; | ||
| 342 | 344 | ||
| 343 | if (probe_ht6560b == 0) | 345 | if (probe_ht6560b == 0) |
| 344 | return -ENODEV; | 346 | return -ENODEV; |
| @@ -357,6 +359,17 @@ static int __init ht6560b_init(void) | |||
| 357 | goto release_region; | 359 | goto release_region; |
| 358 | } | 360 | } |
| 359 | 361 | ||
| 362 | memset(&hw, 0, sizeof(hw)); | ||
| 363 | |||
| 364 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
| 365 | hw[0].irq = 14; | ||
| 366 | |||
| 367 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
| 368 | hw[1].irq = 15; | ||
| 369 | |||
| 370 | ide_init_port_hw(hwif, &hw[0]); | ||
| 371 | ide_init_port_hw(mate, &hw[1]); | ||
| 372 | |||
| 360 | hwif->selectproc = &ht6560b_selectproc; | 373 | hwif->selectproc = &ht6560b_selectproc; |
| 361 | hwif->set_pio_mode = &ht6560b_set_pio_mode; | 374 | hwif->set_pio_mode = &ht6560b_set_pio_mode; |
| 362 | 375 | ||
diff --git a/drivers/ide/legacy/ide-4drives.c b/drivers/ide/legacy/ide-4drives.c new file mode 100644 index 000000000000..ecd7f3553554 --- /dev/null +++ b/drivers/ide/legacy/ide-4drives.c | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | |||
| 2 | #include <linux/kernel.h> | ||
| 3 | #include <linux/init.h> | ||
| 4 | #include <linux/module.h> | ||
| 5 | #include <linux/ide.h> | ||
| 6 | |||
| 7 | int probe_4drives = 0; | ||
| 8 | |||
| 9 | module_param_named(probe, probe_4drives, bool, 0); | ||
| 10 | MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port"); | ||
| 11 | |||
| 12 | static int __init ide_4drives_init(void) | ||
| 13 | { | ||
| 14 | ide_hwif_t *hwif, *mate; | ||
| 15 | u8 idx[4] = { 0, 1, 0xff, 0xff }; | ||
| 16 | hw_regs_t hw; | ||
| 17 | |||
| 18 | if (probe_4drives == 0) | ||
| 19 | return -ENODEV; | ||
| 20 | |||
| 21 | hwif = &ide_hwifs[0]; | ||
| 22 | mate = &ide_hwifs[1]; | ||
| 23 | |||
| 24 | memset(&hw, 0, sizeof(hw)); | ||
| 25 | |||
| 26 | ide_std_init_ports(&hw, 0x1f0, 0x3f6); | ||
| 27 | hw.irq = 14; | ||
| 28 | hw.chipset = ide_4drives; | ||
| 29 | |||
| 30 | ide_init_port_hw(hwif, &hw); | ||
| 31 | ide_init_port_hw(mate, &hw); | ||
| 32 | |||
| 33 | mate->drives[0].select.all ^= 0x20; | ||
| 34 | mate->drives[1].select.all ^= 0x20; | ||
| 35 | |||
| 36 | hwif->mate = mate; | ||
| 37 | mate->mate = hwif; | ||
| 38 | |||
| 39 | hwif->serialized = mate->serialized = 1; | ||
| 40 | |||
| 41 | ide_device_add(idx, NULL); | ||
| 42 | |||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | module_init(ide_4drives_init); | ||
| 47 | |||
| 48 | MODULE_AUTHOR("Bartlomiej Zolnierkiewicz"); | ||
| 49 | MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support"); | ||
| 50 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 15ccf6944ae2..9a23b94f2939 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
| @@ -156,15 +156,15 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq | |||
| 156 | hw.chipset = ide_pci; | 156 | hw.chipset = ide_pci; |
| 157 | hw.dev = &handle->dev; | 157 | hw.dev = &handle->dev; |
| 158 | 158 | ||
| 159 | hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]); | 159 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
| 160 | if (hwif == NULL) | 160 | if (hwif == NULL) |
| 161 | return -1; | 161 | return -1; |
| 162 | 162 | ||
| 163 | i = hwif->index; | 163 | i = hwif->index; |
| 164 | 164 | ||
| 165 | if (hwif->present) | 165 | if (hwif->present) |
| 166 | ide_unregister(i, 0, 0); | 166 | ide_unregister(i); |
| 167 | else if (!hwif->hold) | 167 | else |
| 168 | ide_init_port_data(hwif, i); | 168 | ide_init_port_data(hwif, i); |
| 169 | 169 | ||
| 170 | ide_init_port_hw(hwif, &hw); | 170 | ide_init_port_hw(hwif, &hw); |
| @@ -360,7 +360,7 @@ void ide_release(struct pcmcia_device *link) | |||
| 360 | if (info->ndev) { | 360 | if (info->ndev) { |
| 361 | /* FIXME: if this fails we need to queue the cleanup somehow | 361 | /* FIXME: if this fails we need to queue the cleanup somehow |
| 362 | -- need to investigate the required PCMCIA magic */ | 362 | -- need to investigate the required PCMCIA magic */ |
| 363 | ide_unregister(info->hd, 0, 0); | 363 | ide_unregister(info->hd); |
| 364 | } | 364 | } |
| 365 | info->ndev = 0; | 365 | info->ndev = 0; |
| 366 | 366 | ||
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 688fcae17488..249651e2da42 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
| @@ -122,7 +122,7 @@ static int __devexit plat_ide_remove(struct platform_device *pdev) | |||
| 122 | { | 122 | { |
| 123 | ide_hwif_t *hwif = pdev->dev.driver_data; | 123 | ide_hwif_t *hwif = pdev->dev.driver_data; |
| 124 | 124 | ||
| 125 | ide_unregister(hwif->index, 0, 0); | 125 | ide_unregister(hwif->index); |
| 126 | 126 | ||
| 127 | return 0; | 127 | return 0; |
| 128 | } | 128 | } |
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 2f4f47ad602f..7016bdf4fcc1 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
| @@ -352,9 +352,9 @@ static const struct ide_port_info qd65xx_port_info __initdata = { | |||
| 352 | static int __init qd_probe(int base) | 352 | static int __init qd_probe(int base) |
| 353 | { | 353 | { |
| 354 | ide_hwif_t *hwif; | 354 | ide_hwif_t *hwif; |
| 355 | u8 config, unit; | ||
| 355 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 356 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
| 356 | u8 config; | 357 | hw_regs_t hw[2]; |
| 357 | u8 unit; | ||
| 358 | 358 | ||
| 359 | config = inb(QD_CONFIG_PORT); | 359 | config = inb(QD_CONFIG_PORT); |
| 360 | 360 | ||
| @@ -363,6 +363,14 @@ static int __init qd_probe(int base) | |||
| 363 | 363 | ||
| 364 | unit = ! (config & QD_CONFIG_IDE_BASEPORT); | 364 | unit = ! (config & QD_CONFIG_IDE_BASEPORT); |
| 365 | 365 | ||
| 366 | memset(&hw, 0, sizeof(hw)); | ||
| 367 | |||
| 368 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
| 369 | hw[0].irq = 14; | ||
| 370 | |||
| 371 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
| 372 | hw[1].irq = 15; | ||
| 373 | |||
| 366 | if ((config & 0xf0) == QD_CONFIG_QD6500) { | 374 | if ((config & 0xf0) == QD_CONFIG_QD6500) { |
| 367 | 375 | ||
| 368 | if (qd_testreg(base)) return 1; /* bad register */ | 376 | if (qd_testreg(base)) return 1; /* bad register */ |
| @@ -379,6 +387,8 @@ static int __init qd_probe(int base) | |||
| 379 | return 1; | 387 | return 1; |
| 380 | } | 388 | } |
| 381 | 389 | ||
| 390 | ide_init_port_hw(hwif, &hw[unit]); | ||
| 391 | |||
| 382 | qd_setup(hwif, base, config); | 392 | qd_setup(hwif, base, config); |
| 383 | 393 | ||
| 384 | hwif->port_init_devs = qd6500_port_init_devs; | 394 | hwif->port_init_devs = qd6500_port_init_devs; |
| @@ -416,6 +426,8 @@ static int __init qd_probe(int base) | |||
| 416 | printk(KERN_INFO "%s: qd6580: single IDE board\n", | 426 | printk(KERN_INFO "%s: qd6580: single IDE board\n", |
| 417 | hwif->name); | 427 | hwif->name); |
| 418 | 428 | ||
| 429 | ide_init_port_hw(hwif, &hw[unit]); | ||
| 430 | |||
| 419 | qd_setup(hwif, base, config | (control << 8)); | 431 | qd_setup(hwif, base, config | (control << 8)); |
| 420 | 432 | ||
| 421 | hwif->port_init_devs = qd6580_port_init_devs; | 433 | hwif->port_init_devs = qd6580_port_init_devs; |
| @@ -435,6 +447,9 @@ static int __init qd_probe(int base) | |||
| 435 | printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n", | 447 | printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n", |
| 436 | hwif->name, mate->name); | 448 | hwif->name, mate->name); |
| 437 | 449 | ||
| 450 | ide_init_port_hw(hwif, &hw[0]); | ||
| 451 | ide_init_port_hw(mate, &hw[1]); | ||
| 452 | |||
| 438 | qd_setup(hwif, base, config | (control << 8)); | 453 | qd_setup(hwif, base, config | (control << 8)); |
| 439 | 454 | ||
| 440 | hwif->port_init_devs = qd6580_port_init_devs; | 455 | hwif->port_init_devs = qd6580_port_init_devs; |
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index 5696ba026005..bc1944811b99 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c | |||
| @@ -130,6 +130,7 @@ static int __init umc8672_probe(void) | |||
| 130 | { | 130 | { |
| 131 | unsigned long flags; | 131 | unsigned long flags; |
| 132 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | 132 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; |
| 133 | hw_regs_t hw[2]; | ||
| 133 | 134 | ||
| 134 | if (!request_region(0x108, 2, "umc8672")) { | 135 | if (!request_region(0x108, 2, "umc8672")) { |
| 135 | printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); | 136 | printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); |
| @@ -148,6 +149,17 @@ static int __init umc8672_probe(void) | |||
| 148 | umc_set_speeds (current_speeds); | 149 | umc_set_speeds (current_speeds); |
| 149 | local_irq_restore(flags); | 150 | local_irq_restore(flags); |
| 150 | 151 | ||
| 152 | memset(&hw, 0, sizeof(hw)); | ||
| 153 | |||
| 154 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
| 155 | hw[0].irq = 14; | ||
| 156 | |||
| 157 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
| 158 | hw[1].irq = 15; | ||
| 159 | |||
| 160 | ide_init_port_hw(&ide_hwifs[0], &hw[0]); | ||
| 161 | ide_init_port_hw(&ide_hwifs[1], &hw[1]); | ||
| 162 | |||
| 151 | ide_hwifs[0].set_pio_mode = &umc_set_pio_mode; | 163 | ide_hwifs[0].set_pio_mode = &umc_set_pio_mode; |
| 152 | ide_hwifs[1].set_pio_mode = &umc_set_pio_mode; | 164 | ide_hwifs[1].set_pio_mode = &umc_set_pio_mode; |
| 153 | 165 | ||
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 85c016bdfd38..9b628248f2f4 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
| @@ -613,9 +613,6 @@ static int au_ide_probe(struct device *dev) | |||
| 613 | 613 | ||
| 614 | hwif->dev = dev; | 614 | hwif->dev = dev; |
| 615 | 615 | ||
| 616 | /* hold should be on in all cases */ | ||
| 617 | hwif->hold = 1; | ||
| 618 | |||
| 619 | hwif->mmio = 1; | 616 | hwif->mmio = 1; |
| 620 | 617 | ||
| 621 | /* If the user has selected DDMA assisted copies, | 618 | /* If the user has selected DDMA assisted copies, |
| @@ -673,7 +670,7 @@ static int au_ide_remove(struct device *dev) | |||
| 673 | ide_hwif_t *hwif = dev_get_drvdata(dev); | 670 | ide_hwif_t *hwif = dev_get_drvdata(dev); |
| 674 | _auide_hwif *ahwif = &auide_hwif; | 671 | _auide_hwif *ahwif = &auide_hwif; |
| 675 | 672 | ||
| 676 | ide_unregister(hwif->index, 0, 0); | 673 | ide_unregister(hwif->index); |
| 677 | 674 | ||
| 678 | iounmap((void *)ahwif->regbase); | 675 | iounmap((void *)ahwif->regbase); |
| 679 | 676 | ||
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 29fbc5ead03b..a1cfe033a55f 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
| @@ -409,19 +409,9 @@ static void __init check_prefetch (unsigned int index) | |||
| 409 | */ | 409 | */ |
| 410 | static void __init setup_device_ptrs (void) | 410 | static void __init setup_device_ptrs (void) |
| 411 | { | 411 | { |
| 412 | unsigned int i; | 412 | cmd_hwif0 = &ide_hwifs[0]; |
| 413 | cmd_hwif1 = &ide_hwifs[1]; | ||
| 413 | 414 | ||
| 414 | cmd_hwif0 = &ide_hwifs[0]; /* default, if not found below */ | ||
| 415 | cmd_hwif1 = &ide_hwifs[1]; /* default, if not found below */ | ||
| 416 | for (i = 0; i < MAX_HWIFS; i++) { | ||
| 417 | ide_hwif_t *hwif = &ide_hwifs[i]; | ||
| 418 | if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) { | ||
| 419 | if (hwif->io_ports[IDE_DATA_OFFSET] == 0x1f0) | ||
| 420 | cmd_hwif0 = hwif; | ||
| 421 | else if (hwif->io_ports[IDE_DATA_OFFSET] == 0x170) | ||
| 422 | cmd_hwif1 = hwif; | ||
| 423 | } | ||
| 424 | } | ||
| 425 | cmd_drives[0] = &cmd_hwif0->drives[0]; | 415 | cmd_drives[0] = &cmd_hwif0->drives[0]; |
| 426 | cmd_drives[1] = &cmd_hwif0->drives[1]; | 416 | cmd_drives[1] = &cmd_hwif0->drives[1]; |
| 427 | cmd_drives[2] = &cmd_hwif1->drives[0]; | 417 | cmd_drives[2] = &cmd_hwif1->drives[0]; |
| @@ -724,6 +714,7 @@ static int __init cmd640x_init(void) | |||
| 724 | unsigned int index; | 714 | unsigned int index; |
| 725 | u8 b, cfr; | 715 | u8 b, cfr; |
| 726 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 716 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
| 717 | hw_regs_t hw[2]; | ||
| 727 | 718 | ||
| 728 | if (cmd640_vlb && probe_for_cmd640_vlb()) { | 719 | if (cmd640_vlb && probe_for_cmd640_vlb()) { |
| 729 | bus_type = "VLB"; | 720 | bus_type = "VLB"; |
| @@ -762,12 +753,23 @@ static int __init cmd640x_init(void) | |||
| 762 | return 0; | 753 | return 0; |
| 763 | } | 754 | } |
| 764 | 755 | ||
| 756 | memset(&hw, 0, sizeof(hw)); | ||
| 757 | |||
| 758 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
| 759 | hw[0].irq = 14; | ||
| 760 | |||
| 761 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
| 762 | hw[1].irq = 15; | ||
| 763 | |||
| 764 | printk(KERN_INFO "cmd640: buggy cmd640%c interface on %s, config=0x%02x" | ||
| 765 | "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr); | ||
| 766 | |||
| 765 | /* | 767 | /* |
| 766 | * Initialize data for primary port | 768 | * Initialize data for primary port |
| 767 | */ | 769 | */ |
| 768 | setup_device_ptrs (); | 770 | setup_device_ptrs (); |
| 769 | printk("%s: buggy cmd640%c interface on %s, config=0x%02x\n", | 771 | |
| 770 | cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); | 772 | ide_init_port_hw(cmd_hwif0, &hw[0]); |
| 771 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 773 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
| 772 | cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; | 774 | cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; |
| 773 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 775 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
| @@ -787,8 +789,7 @@ static int __init cmd640x_init(void) | |||
| 787 | /* | 789 | /* |
| 788 | * Try to enable the secondary interface, if not already enabled | 790 | * Try to enable the secondary interface, if not already enabled |
| 789 | */ | 791 | */ |
| 790 | if (cmd_hwif1->noprobe || | 792 | if (cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe) { |
| 791 | (cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe)) { | ||
| 792 | port2 = "not probed"; | 793 | port2 = "not probed"; |
| 793 | } else { | 794 | } else { |
| 794 | b = get_cmd640_reg(CNTRL); | 795 | b = get_cmd640_reg(CNTRL); |
| @@ -820,6 +821,7 @@ static int __init cmd640x_init(void) | |||
| 820 | * Initialize data for secondary cmd640 port, if enabled | 821 | * Initialize data for secondary cmd640 port, if enabled |
| 821 | */ | 822 | */ |
| 822 | if (second_port_cmd640) { | 823 | if (second_port_cmd640) { |
| 824 | ide_init_port_hw(cmd_hwif1, &hw[1]); | ||
| 823 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 825 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
| 824 | cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; | 826 | cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; |
| 825 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 827 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 3f9cd64c26a6..961698d655eb 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
| @@ -78,15 +78,15 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
| 78 | hw.irq = dev->irq; | 78 | hw.irq = dev->irq; |
| 79 | hw.chipset = ide_pci; /* this enables IRQ sharing */ | 79 | hw.chipset = ide_pci; /* this enables IRQ sharing */ |
| 80 | 80 | ||
| 81 | hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]); | 81 | hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
| 82 | if (hwif == NULL) | 82 | if (hwif == NULL) |
| 83 | goto out_disable; | 83 | goto out_disable; |
| 84 | 84 | ||
| 85 | i = hwif->index; | 85 | i = hwif->index; |
| 86 | 86 | ||
| 87 | if (hwif->present) | 87 | if (hwif->present) |
| 88 | ide_unregister(i, 0, 0); | 88 | ide_unregister(i); |
| 89 | else if (!hwif->hold) | 89 | else |
| 90 | ide_init_port_data(hwif, i); | 90 | ide_init_port_data(hwif, i); |
| 91 | 91 | ||
| 92 | ide_init_port_hw(hwif, &hw); | 92 | ide_init_port_hw(hwif, &hw); |
| @@ -120,7 +120,7 @@ delkin_cb_remove (struct pci_dev *dev) | |||
| 120 | ide_hwif_t *hwif = pci_get_drvdata(dev); | 120 | ide_hwif_t *hwif = pci_get_drvdata(dev); |
| 121 | 121 | ||
| 122 | if (hwif) | 122 | if (hwif) |
| 123 | ide_unregister(hwif->index, 0, 0); | 123 | ide_unregister(hwif->index); |
| 124 | 124 | ||
| 125 | pci_disable_device(dev); | 125 | pci_disable_device(dev); |
| 126 | } | 126 | } |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 6357bb6269ab..82d0e318a1fe 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
| @@ -760,7 +760,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | |||
| 760 | } | 760 | } |
| 761 | } else | 761 | } else |
| 762 | outb(mask ? (drive->ctl | 2) : (drive->ctl & ~2), | 762 | outb(mask ? (drive->ctl | 2) : (drive->ctl & ~2), |
| 763 | IDE_CONTROL_REG); | 763 | hwif->io_ports[IDE_CONTROL_OFFSET]); |
| 764 | } | 764 | } |
| 765 | 765 | ||
| 766 | /* | 766 | /* |
| @@ -929,64 +929,6 @@ static void hpt3xxn_rw_disk(ide_drive_t *drive, struct request *rq) | |||
| 929 | hpt3xxn_set_clock(HWIF(drive), rq_data_dir(rq) ? 0x23 : 0x21); | 929 | hpt3xxn_set_clock(HWIF(drive), rq_data_dir(rq) ? 0x23 : 0x21); |
| 930 | } | 930 | } |
| 931 | 931 | ||
| 932 | /* | ||
| 933 | * Set/get power state for a drive. | ||
| 934 | * NOTE: affects both drives on each channel. | ||
| 935 | * | ||
| 936 | * When we turn the power back on, we need to re-initialize things. | ||
| 937 | */ | ||
| 938 | #define TRISTATE_BIT 0x8000 | ||
| 939 | |||
| 940 | static int hpt3xx_busproc(ide_drive_t *drive, int state) | ||
| 941 | { | ||
| 942 | ide_hwif_t *hwif = HWIF(drive); | ||
| 943 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
| 944 | u8 mcr_addr = hwif->select_data + 2; | ||
| 945 | u8 resetmask = hwif->channel ? 0x80 : 0x40; | ||
| 946 | u8 bsr2 = 0; | ||
| 947 | u16 mcr = 0; | ||
| 948 | |||
| 949 | hwif->bus_state = state; | ||
| 950 | |||
| 951 | /* Grab the status. */ | ||
| 952 | pci_read_config_word(dev, mcr_addr, &mcr); | ||
| 953 | pci_read_config_byte(dev, 0x59, &bsr2); | ||
| 954 | |||
| 955 | /* | ||
| 956 | * Set the state. We don't set it if we don't need to do so. | ||
| 957 | * Make sure that the drive knows that it has failed if it's off. | ||
| 958 | */ | ||
| 959 | switch (state) { | ||
| 960 | case BUSSTATE_ON: | ||
| 961 | if (!(bsr2 & resetmask)) | ||
| 962 | return 0; | ||
| 963 | hwif->drives[0].failures = hwif->drives[1].failures = 0; | ||
| 964 | |||
| 965 | pci_write_config_byte(dev, 0x59, bsr2 & ~resetmask); | ||
| 966 | pci_write_config_word(dev, mcr_addr, mcr & ~TRISTATE_BIT); | ||
| 967 | return 0; | ||
| 968 | case BUSSTATE_OFF: | ||
| 969 | if ((bsr2 & resetmask) && !(mcr & TRISTATE_BIT)) | ||
| 970 | return 0; | ||
| 971 | mcr &= ~TRISTATE_BIT; | ||
| 972 | break; | ||
| 973 | case BUSSTATE_TRISTATE: | ||
| 974 | if ((bsr2 & resetmask) && (mcr & TRISTATE_BIT)) | ||
| 975 | return 0; | ||
| 976 | mcr |= TRISTATE_BIT; | ||
| 977 | break; | ||
| 978 | default: | ||
| 979 | return -EINVAL; | ||
| 980 | } | ||
| 981 | |||
| 982 | hwif->drives[0].failures = hwif->drives[0].max_failures + 1; | ||
| 983 | hwif->drives[1].failures = hwif->drives[1].max_failures + 1; | ||
| 984 | |||
| 985 | pci_write_config_word(dev, mcr_addr, mcr); | ||
| 986 | pci_write_config_byte(dev, 0x59, bsr2 | resetmask); | ||
| 987 | return 0; | ||
| 988 | } | ||
| 989 | |||
| 990 | /** | 932 | /** |
| 991 | * hpt37x_calibrate_dpll - calibrate the DPLL | 933 | * hpt37x_calibrate_dpll - calibrate the DPLL |
| 992 | * @dev: PCI device | 934 | * @dev: PCI device |
| @@ -1334,7 +1276,6 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | |||
| 1334 | 1276 | ||
| 1335 | hwif->quirkproc = &hpt3xx_quirkproc; | 1277 | hwif->quirkproc = &hpt3xx_quirkproc; |
| 1336 | hwif->maskproc = &hpt3xx_maskproc; | 1278 | hwif->maskproc = &hpt3xx_maskproc; |
| 1337 | hwif->busproc = &hpt3xx_busproc; | ||
| 1338 | 1279 | ||
| 1339 | hwif->udma_filter = &hpt3xx_udma_filter; | 1280 | hwif->udma_filter = &hpt3xx_udma_filter; |
| 1340 | hwif->mdma_filter = &hpt3xx_mdma_filter; | 1281 | hwif->mdma_filter = &hpt3xx_mdma_filter; |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index bf0d3b2931f1..75513320aad9 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
| @@ -181,6 +181,10 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive) | |||
| 181 | return 1; | 181 | return 1; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | #ifndef ide_default_irq | ||
| 185 | #define ide_default_irq(irq) 0 | ||
| 186 | #endif | ||
| 187 | |||
| 184 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | 188 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) |
| 185 | { | 189 | { |
| 186 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 190 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 238e3e181e87..ef07c7a8b97a 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
| @@ -334,7 +334,8 @@ static int scc_ide_dma_end(ide_drive_t * drive) | |||
| 334 | 334 | ||
| 335 | /* errata A308 workaround: Step5 (check data loss) */ | 335 | /* errata A308 workaround: Step5 (check data loss) */ |
| 336 | /* We don't check non ide_disk because it is limited to UDMA4 */ | 336 | /* We don't check non ide_disk because it is limited to UDMA4 */ |
| 337 | if (!(in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT) && | 337 | if (!(in_be32((void __iomem *)hwif->io_ports[IDE_ALTSTATUS_OFFSET]) |
| 338 | & ERR_STAT) && | ||
| 338 | drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) { | 339 | drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) { |
| 339 | reg = in_be32((void __iomem *)intsts_port); | 340 | reg = in_be32((void __iomem *)intsts_port); |
| 340 | if (!(reg & INTSTS_ACTEINT)) { | 341 | if (!(reg & INTSTS_ACTEINT)) { |
| @@ -437,7 +438,8 @@ static int scc_dma_test_irq(ide_drive_t *drive) | |||
| 437 | u32 int_stat = in_be32((void __iomem *)hwif->dma_base + 0x014); | 438 | u32 int_stat = in_be32((void __iomem *)hwif->dma_base + 0x014); |
| 438 | 439 | ||
| 439 | /* SCC errata A252,A308 workaround: Step4 */ | 440 | /* SCC errata A252,A308 workaround: Step4 */ |
| 440 | if ((in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT) && | 441 | if ((in_be32((void __iomem *)hwif->io_ports[IDE_ALTSTATUS_OFFSET]) |
| 442 | & ERR_STAT) && | ||
| 441 | (int_stat & INTSTS_INTRQ)) | 443 | (int_stat & INTSTS_INTRQ)) |
| 442 | return 1; | 444 | return 1; |
| 443 | 445 | ||
| @@ -523,6 +525,43 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name) | |||
| 523 | return -ENOMEM; | 525 | return -ENOMEM; |
| 524 | } | 526 | } |
| 525 | 527 | ||
| 528 | static int scc_ide_setup_pci_device(struct pci_dev *dev, | ||
| 529 | const struct ide_port_info *d) | ||
| 530 | { | ||
| 531 | struct scc_ports *ports = pci_get_drvdata(dev); | ||
| 532 | ide_hwif_t *hwif = NULL; | ||
| 533 | hw_regs_t hw; | ||
| 534 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
| 535 | int i; | ||
| 536 | |||
| 537 | for (i = 0; i < MAX_HWIFS; i++) { | ||
| 538 | hwif = &ide_hwifs[i]; | ||
| 539 | if (hwif->chipset == ide_unknown) | ||
| 540 | break; /* pick an unused entry */ | ||
| 541 | } | ||
| 542 | if (i == MAX_HWIFS) { | ||
| 543 | printk(KERN_ERR "%s: too many IDE interfaces, " | ||
| 544 | "no room in table\n", SCC_PATA_NAME); | ||
| 545 | return -ENOMEM; | ||
| 546 | } | ||
| 547 | |||
| 548 | memset(&hw, 0, sizeof(hw)); | ||
| 549 | for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; i++) | ||
| 550 | hw.io_ports[i] = ports->dma + 0x20 + i * 4; | ||
| 551 | hw.irq = dev->irq; | ||
| 552 | hw.dev = &dev->dev; | ||
| 553 | hw.chipset = ide_pci; | ||
| 554 | ide_init_port_hw(hwif, &hw); | ||
| 555 | hwif->dev = &dev->dev; | ||
| 556 | hwif->cds = d; | ||
| 557 | |||
| 558 | idx[0] = hwif->index; | ||
| 559 | |||
| 560 | ide_device_add(idx, d); | ||
| 561 | |||
| 562 | return 0; | ||
| 563 | } | ||
| 564 | |||
| 526 | /** | 565 | /** |
| 527 | * init_setup_scc - set up an SCC PATA Controller | 566 | * init_setup_scc - set up an SCC PATA Controller |
| 528 | * @dev: PCI device | 567 | * @dev: PCI device |
| @@ -545,10 +584,13 @@ static int __devinit init_setup_scc(struct pci_dev *dev, | |||
| 545 | struct scc_ports *ports; | 584 | struct scc_ports *ports; |
| 546 | int rc; | 585 | int rc; |
| 547 | 586 | ||
| 587 | rc = pci_enable_device(dev); | ||
| 588 | if (rc) | ||
| 589 | goto end; | ||
| 590 | |||
| 548 | rc = setup_mmio_scc(dev, d->name); | 591 | rc = setup_mmio_scc(dev, d->name); |
| 549 | if (rc < 0) { | 592 | if (rc < 0) |
| 550 | return rc; | 593 | goto end; |
| 551 | } | ||
| 552 | 594 | ||
| 553 | ports = pci_get_drvdata(dev); | 595 | ports = pci_get_drvdata(dev); |
| 554 | ctl_base = ports->ctl; | 596 | ctl_base = ports->ctl; |
| @@ -583,7 +625,10 @@ static int __devinit init_setup_scc(struct pci_dev *dev, | |||
| 583 | out_be32((void*)mode_port, MODE_JCUSFEN); | 625 | out_be32((void*)mode_port, MODE_JCUSFEN); |
| 584 | out_be32((void*)intmask_port, INTMASK_MSK); | 626 | out_be32((void*)intmask_port, INTMASK_MSK); |
| 585 | 627 | ||
| 586 | return ide_setup_pci_device(dev, d); | 628 | rc = scc_ide_setup_pci_device(dev, d); |
| 629 | |||
| 630 | end: | ||
| 631 | return rc; | ||
| 587 | } | 632 | } |
| 588 | 633 | ||
| 589 | /** | 634 | /** |
| @@ -610,17 +655,6 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | |||
| 610 | hwif->OUTSW = scc_ide_outsw; | 655 | hwif->OUTSW = scc_ide_outsw; |
| 611 | hwif->OUTSL = scc_ide_outsl; | 656 | hwif->OUTSL = scc_ide_outsl; |
| 612 | 657 | ||
| 613 | hwif->io_ports[IDE_DATA_OFFSET] = dma_base + 0x20; | ||
| 614 | hwif->io_ports[IDE_ERROR_OFFSET] = dma_base + 0x24; | ||
| 615 | hwif->io_ports[IDE_NSECTOR_OFFSET] = dma_base + 0x28; | ||
| 616 | hwif->io_ports[IDE_SECTOR_OFFSET] = dma_base + 0x2c; | ||
| 617 | hwif->io_ports[IDE_LCYL_OFFSET] = dma_base + 0x30; | ||
| 618 | hwif->io_ports[IDE_HCYL_OFFSET] = dma_base + 0x34; | ||
| 619 | hwif->io_ports[IDE_SELECT_OFFSET] = dma_base + 0x38; | ||
| 620 | hwif->io_ports[IDE_STATUS_OFFSET] = dma_base + 0x3c; | ||
| 621 | hwif->io_ports[IDE_CONTROL_OFFSET] = dma_base + 0x40; | ||
| 622 | |||
| 623 | hwif->irq = dev->irq; | ||
| 624 | hwif->dma_base = dma_base; | 658 | hwif->dma_base = dma_base; |
| 625 | hwif->config_data = ports->ctl; | 659 | hwif->config_data = ports->ctl; |
| 626 | hwif->mmio = 1; | 660 | hwif->mmio = 1; |
| @@ -736,7 +770,7 @@ static void __devexit scc_remove(struct pci_dev *dev) | |||
| 736 | hwif->dmatable_cpu = NULL; | 770 | hwif->dmatable_cpu = NULL; |
| 737 | } | 771 | } |
| 738 | 772 | ||
| 739 | ide_unregister(hwif->index, 0, 0); | 773 | ide_unregister(hwif->index); |
| 740 | 774 | ||
| 741 | hwif->chipset = ide_unknown; | 775 | hwif->chipset = ide_unknown; |
| 742 | iounmap((void*)ports->dma); | 776 | iounmap((void*)ports->dma); |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 054626497be4..9d1a3038af9b 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
| @@ -112,10 +112,9 @@ static void | |||
| 112 | sgiioc4_maskproc(ide_drive_t * drive, int mask) | 112 | sgiioc4_maskproc(ide_drive_t * drive, int mask) |
| 113 | { | 113 | { |
| 114 | writeb(mask ? (drive->ctl | 2) : (drive->ctl & ~2), | 114 | writeb(mask ? (drive->ctl | 2) : (drive->ctl & ~2), |
| 115 | (void __iomem *)IDE_CONTROL_REG); | 115 | (void __iomem *)drive->hwif->io_ports[IDE_CONTROL_OFFSET]); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | |||
| 119 | static int | 118 | static int |
| 120 | sgiioc4_checkirq(ide_hwif_t * hwif) | 119 | sgiioc4_checkirq(ide_hwif_t * hwif) |
| 121 | { | 120 | { |
| @@ -142,18 +141,18 @@ sgiioc4_clearirq(ide_drive_t * drive) | |||
| 142 | intr_reg = readl((void __iomem *)other_ir); | 141 | intr_reg = readl((void __iomem *)other_ir); |
| 143 | if (intr_reg & 0x03) { /* Valid IOC4-IDE interrupt */ | 142 | if (intr_reg & 0x03) { /* Valid IOC4-IDE interrupt */ |
| 144 | /* | 143 | /* |
| 145 | * Using sgiioc4_INB to read the IDE_STATUS_REG has a side effect | 144 | * Using sgiioc4_INB to read the Status register has a side |
| 146 | * of clearing the interrupt. The first read should clear it | 145 | * effect of clearing the interrupt. The first read should |
| 147 | * if it is set. The second read should return a "clear" status | 146 | * clear it if it is set. The second read should return |
| 148 | * if it got cleared. If not, then spin for a bit trying to | 147 | * a "clear" status if it got cleared. If not, then spin |
| 149 | * clear it. | 148 | * for a bit trying to clear it. |
| 150 | */ | 149 | */ |
| 151 | u8 stat = sgiioc4_INB(IDE_STATUS_REG); | 150 | u8 stat = sgiioc4_INB(hwif->io_ports[IDE_STATUS_OFFSET]); |
| 152 | int count = 0; | 151 | int count = 0; |
| 153 | stat = sgiioc4_INB(IDE_STATUS_REG); | 152 | stat = sgiioc4_INB(hwif->io_ports[IDE_STATUS_OFFSET]); |
| 154 | while ((stat & 0x80) && (count++ < 100)) { | 153 | while ((stat & 0x80) && (count++ < 100)) { |
| 155 | udelay(1); | 154 | udelay(1); |
| 156 | stat = sgiioc4_INB(IDE_STATUS_REG); | 155 | stat = sgiioc4_INB(hwif->io_ports[IDE_STATUS_OFFSET]); |
| 157 | } | 156 | } |
| 158 | 157 | ||
| 159 | if (intr_reg & 0x02) { | 158 | if (intr_reg & 0x02) { |
| @@ -562,7 +561,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif) | |||
| 562 | clear interrupts */ | 561 | clear interrupts */ |
| 563 | hwif->maskproc = &sgiioc4_maskproc; /* Mask on/off NIEN register */ | 562 | hwif->maskproc = &sgiioc4_maskproc; /* Mask on/off NIEN register */ |
| 564 | hwif->quirkproc = NULL; | 563 | hwif->quirkproc = NULL; |
| 565 | hwif->busproc = NULL; | ||
| 566 | 564 | ||
| 567 | hwif->INB = &sgiioc4_INB; | 565 | hwif->INB = &sgiioc4_INB; |
| 568 | 566 | ||
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 8d624afe8529..b6be1b45f329 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
| @@ -370,48 +370,6 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | /** | 372 | /** |
| 373 | * sil_sata_busproc - bus isolation IOCTL | ||
| 374 | * @drive: drive to isolate/restore | ||
| 375 | * @state: bus state to set | ||
| 376 | * | ||
| 377 | * Used by the SII3112 to handle bus isolation. As this is a | ||
| 378 | * SATA controller the work required is quite limited, we | ||
| 379 | * just have to clean up the statistics | ||
| 380 | */ | ||
| 381 | |||
| 382 | static int sil_sata_busproc(ide_drive_t * drive, int state) | ||
| 383 | { | ||
| 384 | ide_hwif_t *hwif = HWIF(drive); | ||
| 385 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
| 386 | u32 stat_config = 0; | ||
| 387 | unsigned long addr = siimage_selreg(hwif, 0); | ||
| 388 | |||
| 389 | if (hwif->mmio) | ||
| 390 | stat_config = readl((void __iomem *)addr); | ||
| 391 | else | ||
| 392 | pci_read_config_dword(dev, addr, &stat_config); | ||
| 393 | |||
| 394 | switch (state) { | ||
| 395 | case BUSSTATE_ON: | ||
| 396 | hwif->drives[0].failures = 0; | ||
| 397 | hwif->drives[1].failures = 0; | ||
| 398 | break; | ||
| 399 | case BUSSTATE_OFF: | ||
| 400 | hwif->drives[0].failures = hwif->drives[0].max_failures + 1; | ||
| 401 | hwif->drives[1].failures = hwif->drives[1].max_failures + 1; | ||
| 402 | break; | ||
| 403 | case BUSSTATE_TRISTATE: | ||
| 404 | hwif->drives[0].failures = hwif->drives[0].max_failures + 1; | ||
| 405 | hwif->drives[1].failures = hwif->drives[1].max_failures + 1; | ||
| 406 | break; | ||
| 407 | default: | ||
| 408 | return -EINVAL; | ||
| 409 | } | ||
| 410 | hwif->bus_state = state; | ||
| 411 | return 0; | ||
| 412 | } | ||
| 413 | |||
| 414 | /** | ||
| 415 | * sil_sata_reset_poll - wait for SATA reset | 373 | * sil_sata_reset_poll - wait for SATA reset |
| 416 | * @drive: drive we are resetting | 374 | * @drive: drive we are resetting |
| 417 | * | 375 | * |
| @@ -818,7 +776,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
| 818 | if (sata) { | 776 | if (sata) { |
| 819 | static int first = 1; | 777 | static int first = 1; |
| 820 | 778 | ||
| 821 | hwif->busproc = &sil_sata_busproc; | ||
| 822 | hwif->reset_poll = &sil_sata_reset_poll; | 779 | hwif->reset_poll = &sil_sata_reset_poll; |
| 823 | hwif->pre_reset = &sil_sata_pre_reset; | 780 | hwif->pre_reset = &sil_sata_pre_reset; |
| 824 | hwif->udma_filter = &sil_sata_udma_filter; | 781 | hwif->udma_filter = &sil_sata_udma_filter; |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index ee261ae15b6f..1f00251a4a87 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
| @@ -328,6 +328,10 @@ static const struct ide_port_info sl82c105_chipset __devinitdata = { | |||
| 328 | .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, | 328 | .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, |
| 329 | .host_flags = IDE_HFLAG_IO_32BIT | | 329 | .host_flags = IDE_HFLAG_IO_32BIT | |
| 330 | IDE_HFLAG_UNMASK_IRQS | | 330 | IDE_HFLAG_UNMASK_IRQS | |
| 331 | /* FIXME: check for Compatibility mode in generic IDE PCI code */ | ||
| 332 | #if defined(CONFIG_LOPEC) || defined(CONFIG_SANDPOINT) | ||
| 333 | IDE_HFLAG_FORCE_LEGACY_IRQS | | ||
| 334 | #endif | ||
| 331 | IDE_HFLAG_NO_AUTODMA | | 335 | IDE_HFLAG_NO_AUTODMA | |
| 332 | IDE_HFLAG_BOOTABLE, | 336 | IDE_HFLAG_BOOTABLE, |
| 333 | .pio_mask = ATA_PIO5, | 337 | .pio_mask = ATA_PIO5, |
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 2ef2ed2f2b32..1e4a6262bcef 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c | |||
| @@ -126,40 +126,6 @@ static void tc86c001_dma_start(ide_drive_t *drive) | |||
| 126 | ide_dma_start(drive); | 126 | ide_dma_start(drive); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | static int tc86c001_busproc(ide_drive_t *drive, int state) | ||
| 130 | { | ||
| 131 | ide_hwif_t *hwif = HWIF(drive); | ||
| 132 | unsigned long sc_base = hwif->config_data; | ||
| 133 | u16 scr1; | ||
| 134 | |||
| 135 | /* System Control 1 Register bit 11 (ATA Hard Reset) read */ | ||
| 136 | scr1 = inw(sc_base + 0x00); | ||
| 137 | |||
| 138 | switch (state) { | ||
| 139 | case BUSSTATE_ON: | ||
| 140 | if (!(scr1 & 0x0800)) | ||
| 141 | return 0; | ||
| 142 | scr1 &= ~0x0800; | ||
| 143 | |||
| 144 | hwif->drives[0].failures = hwif->drives[1].failures = 0; | ||
| 145 | break; | ||
| 146 | case BUSSTATE_OFF: | ||
| 147 | if (scr1 & 0x0800) | ||
| 148 | return 0; | ||
| 149 | scr1 |= 0x0800; | ||
| 150 | |||
| 151 | hwif->drives[0].failures = hwif->drives[0].max_failures + 1; | ||
| 152 | hwif->drives[1].failures = hwif->drives[1].max_failures + 1; | ||
| 153 | break; | ||
| 154 | default: | ||
| 155 | return -EINVAL; | ||
| 156 | } | ||
| 157 | |||
| 158 | /* System Control 1 Register bit 11 (ATA Hard Reset) write */ | ||
| 159 | outw(scr1, sc_base + 0x00); | ||
| 160 | return 0; | ||
| 161 | } | ||
| 162 | |||
| 163 | static u8 __devinit tc86c001_cable_detect(ide_hwif_t *hwif) | 129 | static u8 __devinit tc86c001_cable_detect(ide_hwif_t *hwif) |
| 164 | { | 130 | { |
| 165 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 131 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
| @@ -194,8 +160,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) | |||
| 194 | hwif->set_pio_mode = &tc86c001_set_pio_mode; | 160 | hwif->set_pio_mode = &tc86c001_set_pio_mode; |
| 195 | hwif->set_dma_mode = &tc86c001_set_mode; | 161 | hwif->set_dma_mode = &tc86c001_set_mode; |
| 196 | 162 | ||
| 197 | hwif->busproc = &tc86c001_busproc; | ||
| 198 | |||
| 199 | hwif->cable_detect = tc86c001_cable_detect; | 163 | hwif->cable_detect = tc86c001_cable_detect; |
| 200 | 164 | ||
| 201 | if (!hwif->dma_base) | 165 | if (!hwif->dma_base) |
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index ebaba01c7551..a784a97ca7ec 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c | |||
| @@ -99,32 +99,6 @@ static int _slot_ = -1; /* will be read from PCMCIA registers */ | |||
| 99 | /* Make clock cycles and always round up */ | 99 | /* Make clock cycles and always round up */ |
| 100 | #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U ) | 100 | #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U ) |
| 101 | 101 | ||
| 102 | |||
| 103 | |||
| 104 | /* | ||
| 105 | * IDE stuff. | ||
| 106 | */ | ||
| 107 | static int | ||
| 108 | m8xx_ide_default_irq(unsigned long base) | ||
| 109 | { | ||
| 110 | #ifdef CONFIG_BLK_DEV_MPC8xx_IDE | ||
| 111 | if (base >= MAX_HWIFS) | ||
| 112 | return 0; | ||
| 113 | |||
| 114 | printk("[%d] m8xx_ide_default_irq %d\n",__LINE__,ioport_dsc[base].irq); | ||
| 115 | |||
| 116 | return (ioport_dsc[base].irq); | ||
| 117 | #else | ||
| 118 | return 9; | ||
| 119 | #endif | ||
| 120 | } | ||
| 121 | |||
| 122 | static unsigned long | ||
| 123 | m8xx_ide_default_io_base(int index) | ||
| 124 | { | ||
| 125 | return index; | ||
| 126 | } | ||
| 127 | |||
| 128 | #define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4)) | 102 | #define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4)) |
| 129 | #define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4)) | 103 | #define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4)) |
| 130 | 104 | ||
| @@ -149,12 +123,11 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL; | |||
| 149 | */ | 123 | */ |
| 150 | 124 | ||
| 151 | /* | 125 | /* |
| 152 | * m8xx_ide_init_hwif_ports for a direct IDE interface _using_ | 126 | * m8xx_ide_init_ports() for a direct IDE interface _using_ |
| 127 | * MPC8xx's internal PCMCIA interface | ||
| 153 | */ | 128 | */ |
| 154 | #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) | 129 | #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) |
| 155 | static void | 130 | static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) |
| 156 | m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, | ||
| 157 | unsigned long ctrl_port, int *irq) | ||
| 158 | { | 131 | { |
| 159 | unsigned long *p = hw->io_ports; | 132 | unsigned long *p = hw->io_ports; |
| 160 | int i; | 133 | int i; |
| @@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, | |||
| 173 | unsigned long base; | 146 | unsigned long base; |
| 174 | 147 | ||
| 175 | *p = 0; | 148 | *p = 0; |
| 176 | if (irq) | ||
| 177 | *irq = 0; | ||
| 178 | 149 | ||
| 179 | pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia)); | 150 | pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia)); |
| 180 | 151 | ||
| @@ -248,9 +219,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, | |||
| 248 | } | 219 | } |
| 249 | } | 220 | } |
| 250 | 221 | ||
| 251 | if (data_port >= MAX_HWIFS) | ||
| 252 | return; | ||
| 253 | |||
| 254 | if (_slot_ == -1) { | 222 | if (_slot_ == -1) { |
| 255 | printk ("PCMCIA slot has not been defined! Using A as default\n"); | 223 | printk ("PCMCIA slot has not been defined! Using A as default\n"); |
| 256 | _slot_ = 0; | 224 | _slot_ = 0; |
| @@ -292,11 +260,13 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, | |||
| 292 | *p++ = base + ioport_dsc[data_port].reg_off[i]; | 260 | *p++ = base + ioport_dsc[data_port].reg_off[i]; |
| 293 | } | 261 | } |
| 294 | 262 | ||
| 295 | if (irq) { | 263 | hw->irq = ioport_dsc[data_port].irq; |
| 264 | hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; | ||
| 265 | |||
| 296 | #ifdef CONFIG_IDE_8xx_PCCARD | 266 | #ifdef CONFIG_IDE_8xx_PCCARD |
| 267 | { | ||
| 297 | unsigned int reg; | 268 | unsigned int reg; |
| 298 | 269 | ||
| 299 | *irq = ioport_dsc[data_port].irq; | ||
| 300 | if (_slot_) | 270 | if (_slot_) |
| 301 | pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb; | 271 | pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb; |
| 302 | else | 272 | else |
| @@ -306,14 +276,11 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, | |||
| 306 | reg |= mk_int_int_mask (pcmcia_schlvl) << 24; | 276 | reg |= mk_int_int_mask (pcmcia_schlvl) << 24; |
| 307 | reg |= mk_int_int_mask (pcmcia_schlvl) << 16; | 277 | reg |= mk_int_int_mask (pcmcia_schlvl) << 16; |
| 308 | *pgcrx = reg; | 278 | *pgcrx = reg; |
| 309 | #else /* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */ | ||
| 310 | *irq = ioport_dsc[data_port].irq; | ||
| 311 | #endif /* CONFIG_IDE_8xx_PCCARD */ | ||
| 312 | } | 279 | } |
| 280 | #endif /* CONFIG_IDE_8xx_PCCARD */ | ||
| 313 | 281 | ||
| 314 | ide_hwifs[data_port].pio_mask = ATA_PIO4; | 282 | ide_hwifs[data_port].pio_mask = ATA_PIO4; |
| 315 | ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; | 283 | ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; |
| 316 | ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; | ||
| 317 | 284 | ||
| 318 | /* Enable Harddisk Interrupt, | 285 | /* Enable Harddisk Interrupt, |
| 319 | * and make it edge sensitive | 286 | * and make it edge sensitive |
| @@ -329,16 +296,15 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, | |||
| 329 | /* Enable falling edge irq */ | 296 | /* Enable falling edge irq */ |
| 330 | pcmp->pcmc_per = 0x100000 >> (16 * _slot_); | 297 | pcmp->pcmc_per = 0x100000 >> (16 * _slot_); |
| 331 | #endif /* CONFIG_IDE_8xx_PCCARD */ | 298 | #endif /* CONFIG_IDE_8xx_PCCARD */ |
| 332 | } /* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */ | 299 | } |
| 333 | #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ | 300 | #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ |
| 334 | 301 | ||
| 335 | /* | 302 | /* |
| 336 | * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using | 303 | * m8xx_ide_init_ports() for a direct IDE interface _not_ using |
| 337 | * MPC8xx's internal PCMCIA interface | 304 | * MPC8xx's internal PCMCIA interface |
| 338 | */ | 305 | */ |
| 339 | #if defined(CONFIG_IDE_EXT_DIRECT) | 306 | #if defined(CONFIG_IDE_EXT_DIRECT) |
| 340 | void m8xx_ide_init_hwif_ports (hw_regs_t *hw, | 307 | static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) |
| 341 | unsigned long data_port, unsigned long ctrl_port, int *irq) | ||
| 342 | { | 308 | { |
| 343 | unsigned long *p = hw->io_ports; | 309 | unsigned long *p = hw->io_ports; |
| 344 | int i; | 310 | int i; |
| @@ -349,8 +315,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, | |||
| 349 | unsigned long base; | 315 | unsigned long base; |
| 350 | 316 | ||
| 351 | *p = 0; | 317 | *p = 0; |
| 352 | if (irq) | ||
| 353 | *irq = 0; | ||
| 354 | 318 | ||
| 355 | if (!ide_base) { | 319 | if (!ide_base) { |
| 356 | 320 | ||
| @@ -372,9 +336,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, | |||
| 372 | #endif | 336 | #endif |
| 373 | } | 337 | } |
| 374 | 338 | ||
| 375 | if (data_port >= MAX_HWIFS) | ||
| 376 | return; | ||
| 377 | |||
| 378 | base = ide_base + ioport_dsc[data_port].base_off; | 339 | base = ide_base + ioport_dsc[data_port].base_off; |
| 379 | #ifdef DEBUG | 340 | #ifdef DEBUG |
| 380 | printk ("base: %08x + %08x = %08x\n", | 341 | printk ("base: %08x + %08x = %08x\n", |
| @@ -392,14 +353,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, | |||
| 392 | *p++ = base + ioport_dsc[data_port].reg_off[i]; | 353 | *p++ = base + ioport_dsc[data_port].reg_off[i]; |
| 393 | } | 354 | } |
| 394 | 355 | ||
| 395 | if (irq) { | 356 | /* direct connected IDE drive, i.e. external IRQ */ |
| 396 | /* direct connected IDE drive, i.e. external IRQ */ | 357 | hw->irq = ioport_dsc[data_port].irq; |
| 397 | *irq = ioport_dsc[data_port].irq; | 358 | hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; |
| 398 | } | ||
| 399 | 359 | ||
| 400 | ide_hwifs[data_port].pio_mask = ATA_PIO4; | 360 | ide_hwifs[data_port].pio_mask = ATA_PIO4; |
| 401 | ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; | 361 | ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; |
| 402 | ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; | ||
| 403 | 362 | ||
| 404 | /* Enable Harddisk Interrupt, | 363 | /* Enable Harddisk Interrupt, |
| 405 | * and make it edge sensitive | 364 | * and make it edge sensitive |
| @@ -407,8 +366,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, | |||
| 407 | /* (11-18) Set edge detect for irq, no wakeup from low power mode */ | 366 | /* (11-18) Set edge detect for irq, no wakeup from low power mode */ |
| 408 | ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= | 367 | ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= |
| 409 | (0x80000000 >> ioport_dsc[data_port].irq); | 368 | (0x80000000 >> ioport_dsc[data_port].irq); |
| 410 | } /* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */ | 369 | } |
| 411 | |||
| 412 | #endif /* CONFIG_IDE_8xx_DIRECT */ | 370 | #endif /* CONFIG_IDE_8xx_DIRECT */ |
| 413 | 371 | ||
| 414 | 372 | ||
| @@ -829,20 +787,20 @@ static int identify (volatile u8 *p) | |||
| 829 | return (0); /* don't know */ | 787 | return (0); /* don't know */ |
| 830 | } | 788 | } |
| 831 | 789 | ||
| 832 | void m8xx_ide_init(void) | ||
| 833 | { | ||
| 834 | ppc_ide_md.default_irq = m8xx_ide_default_irq; | ||
| 835 | ppc_ide_md.default_io_base = m8xx_ide_default_io_base; | ||
| 836 | ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports; | ||
| 837 | } | ||
| 838 | |||
| 839 | static int __init mpc8xx_ide_probe(void) | 790 | static int __init mpc8xx_ide_probe(void) |
| 840 | { | 791 | { |
| 792 | hw_regs_t hw; | ||
| 841 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 793 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
| 842 | 794 | ||
| 843 | #ifdef IDE0_BASE_OFFSET | 795 | #ifdef IDE0_BASE_OFFSET |
| 796 | memset(&hw, 0, sizeof(hw)); | ||
| 797 | m8xx_ide_init_ports(&hw, 0); | ||
| 798 | ide_init_port_hw(&ide_hwifs[0], &hw); | ||
| 844 | idx[0] = 0; | 799 | idx[0] = 0; |
| 845 | #ifdef IDE1_BASE_OFFSET | 800 | #ifdef IDE1_BASE_OFFSET |
| 801 | memset(&hw, 0, sizeof(hw)); | ||
| 802 | m8xx_ide_init_ports(&hw, 1); | ||
| 803 | ide_init_port_hw(&ide_hwifs[1], &hw); | ||
| 846 | idx[1] = 1; | 804 | idx[1] = 1; |
| 847 | #endif | 805 | #endif |
| 848 | #endif | 806 | #endif |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index d9ca52e6cdab..88619b50d9ef 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
| @@ -80,7 +80,6 @@ typedef struct pmac_ide_hwif { | |||
| 80 | } pmac_ide_hwif_t; | 80 | } pmac_ide_hwif_t; |
| 81 | 81 | ||
| 82 | static pmac_ide_hwif_t pmac_ide[MAX_HWIFS]; | 82 | static pmac_ide_hwif_t pmac_ide[MAX_HWIFS]; |
| 83 | static int pmac_ide_count; | ||
| 84 | 83 | ||
| 85 | enum { | 84 | enum { |
| 86 | controller_ohare, /* OHare based */ | 85 | controller_ohare, /* OHare based */ |
| @@ -419,38 +418,8 @@ static void pmac_ide_kauai_selectproc(ide_drive_t *drive); | |||
| 419 | 418 | ||
| 420 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 419 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ |
| 421 | 420 | ||
| 422 | /* | 421 | #define PMAC_IDE_REG(x) \ |
| 423 | * N.B. this can't be an initfunc, because the media-bay task can | 422 | ((void __iomem *)((drive)->hwif->io_ports[IDE_DATA_OFFSET] + (x))) |
| 424 | * call ide_[un]register at any time. | ||
| 425 | */ | ||
| 426 | void | ||
| 427 | pmac_ide_init_hwif_ports(hw_regs_t *hw, | ||
| 428 | unsigned long data_port, unsigned long ctrl_port, | ||
| 429 | int *irq) | ||
| 430 | { | ||
| 431 | int i, ix; | ||
| 432 | |||
| 433 | if (data_port == 0) | ||
| 434 | return; | ||
| 435 | |||
| 436 | for (ix = 0; ix < MAX_HWIFS; ++ix) | ||
| 437 | if (data_port == pmac_ide[ix].regbase) | ||
| 438 | break; | ||
| 439 | |||
| 440 | if (ix >= MAX_HWIFS) | ||
| 441 | return; /* not an IDE PMAC interface */ | ||
| 442 | |||
| 443 | for (i = 0; i < 8; ++i) | ||
| 444 | hw->io_ports[i] = data_port + i * 0x10; | ||
| 445 | hw->io_ports[8] = data_port + 0x160; | ||
| 446 | |||
| 447 | if (irq != NULL) | ||
| 448 | *irq = pmac_ide[ix].irq; | ||
| 449 | |||
| 450 | hw->dev = &pmac_ide[ix].mdev->ofdev.dev; | ||
| 451 | } | ||
| 452 | |||
| 453 | #define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x))) | ||
| 454 | 423 | ||
| 455 | /* | 424 | /* |
| 456 | * Apply the timings of the proper unit (master/slave) to the shared | 425 | * Apply the timings of the proper unit (master/slave) to the shared |
| @@ -886,58 +855,6 @@ sanitize_timings(pmac_ide_hwif_t *pmif) | |||
| 886 | pmif->timings[2] = pmif->timings[3] = value2; | 855 | pmif->timings[2] = pmif->timings[3] = value2; |
| 887 | } | 856 | } |
| 888 | 857 | ||
| 889 | unsigned long | ||
| 890 | pmac_ide_get_base(int index) | ||
| 891 | { | ||
| 892 | return pmac_ide[index].regbase; | ||
| 893 | } | ||
| 894 | |||
| 895 | int | ||
| 896 | pmac_ide_check_base(unsigned long base) | ||
| 897 | { | ||
| 898 | int ix; | ||
| 899 | |||
| 900 | for (ix = 0; ix < MAX_HWIFS; ++ix) | ||
| 901 | if (base == pmac_ide[ix].regbase) | ||
| 902 | return ix; | ||
| 903 | return -1; | ||
| 904 | } | ||
| 905 | |||
| 906 | int | ||
| 907 | pmac_ide_get_irq(unsigned long base) | ||
| 908 | { | ||
| 909 | int ix; | ||
| 910 | |||
| 911 | for (ix = 0; ix < MAX_HWIFS; ++ix) | ||
| 912 | if (base == pmac_ide[ix].regbase) | ||
| 913 | return pmac_ide[ix].irq; | ||
| 914 | return 0; | ||
| 915 | } | ||
| 916 | |||
| 917 | static int ide_majors[] = { 3, 22, 33, 34, 56, 57 }; | ||
| 918 | |||
| 919 | dev_t __init | ||
| 920 | pmac_find_ide_boot(char *bootdevice, int n) | ||
| 921 | { | ||
| 922 | int i; | ||
| 923 | |||
| 924 | /* | ||
| 925 | * Look through the list of IDE interfaces for this one. | ||
| 926 | */ | ||
| 927 | for (i = 0; i < pmac_ide_count; ++i) { | ||
| 928 | char *name; | ||
| 929 | if (!pmac_ide[i].node || !pmac_ide[i].node->full_name) | ||
| 930 | continue; | ||
| 931 | name = pmac_ide[i].node->full_name; | ||
| 932 | if (memcmp(name, bootdevice, n) == 0 && name[n] == 0) { | ||
| 933 | /* XXX should cope with the 2nd drive as well... */ | ||
| 934 | return MKDEV(ide_majors[i], 0); | ||
| 935 | } | ||
| 936 | } | ||
| 937 | |||
| 938 | return 0; | ||
| 939 | } | ||
| 940 | |||
| 941 | /* Suspend call back, should be called after the child devices | 858 | /* Suspend call back, should be called after the child devices |
| 942 | * have actually been suspended | 859 | * have actually been suspended |
| 943 | */ | 860 | */ |
| @@ -1088,7 +1005,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
| 1088 | if (np->parent && np->parent->name | 1005 | if (np->parent && np->parent->name |
| 1089 | && strcasecmp(np->parent->name, "media-bay") == 0) { | 1006 | && strcasecmp(np->parent->name, "media-bay") == 0) { |
| 1090 | #ifdef CONFIG_PMAC_MEDIABAY | 1007 | #ifdef CONFIG_PMAC_MEDIABAY |
| 1091 | media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index); | 1008 | media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, |
| 1009 | hwif); | ||
| 1092 | #endif /* CONFIG_PMAC_MEDIABAY */ | 1010 | #endif /* CONFIG_PMAC_MEDIABAY */ |
| 1093 | pmif->mediabay = 1; | 1011 | pmif->mediabay = 1; |
| 1094 | if (!bidp) | 1012 | if (!bidp) |
| @@ -1119,7 +1037,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
| 1119 | hwif->hwif_data = pmif; | 1037 | hwif->hwif_data = pmif; |
| 1120 | ide_init_port_hw(hwif, hw); | 1038 | ide_init_port_hw(hwif, hw); |
| 1121 | hwif->noprobe = pmif->mediabay; | 1039 | hwif->noprobe = pmif->mediabay; |
| 1122 | hwif->hold = pmif->mediabay; | ||
| 1123 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | 1040 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
| 1124 | hwif->set_pio_mode = pmac_ide_set_pio_mode; | 1041 | hwif->set_pio_mode = pmac_ide_set_pio_mode; |
| 1125 | if (pmif->kind == controller_un_ata6 | 1042 | if (pmif->kind == controller_un_ata6 |
| @@ -1154,6 +1071,15 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
| 1154 | return 0; | 1071 | return 0; |
| 1155 | } | 1072 | } |
| 1156 | 1073 | ||
| 1074 | static void __devinit pmac_ide_init_ports(hw_regs_t *hw, unsigned long base) | ||
| 1075 | { | ||
| 1076 | int i; | ||
| 1077 | |||
| 1078 | for (i = 0; i < 8; ++i) | ||
| 1079 | hw->io_ports[i] = base + i * 0x10; | ||
| 1080 | hw->io_ports[8] = base + 0x160; | ||
| 1081 | } | ||
| 1082 | |||
| 1157 | /* | 1083 | /* |
| 1158 | * Attach to a macio probed interface | 1084 | * Attach to a macio probed interface |
| 1159 | */ | 1085 | */ |
| @@ -1227,7 +1153,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
| 1227 | dev_set_drvdata(&mdev->ofdev.dev, hwif); | 1153 | dev_set_drvdata(&mdev->ofdev.dev, hwif); |
| 1228 | 1154 | ||
| 1229 | memset(&hw, 0, sizeof(hw)); | 1155 | memset(&hw, 0, sizeof(hw)); |
| 1230 | pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL); | 1156 | pmac_ide_init_ports(&hw, pmif->regbase); |
| 1231 | hw.irq = irq; | 1157 | hw.irq = irq; |
| 1232 | hw.dev = &mdev->ofdev.dev; | 1158 | hw.dev = &mdev->ofdev.dev; |
| 1233 | 1159 | ||
| @@ -1341,7 +1267,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1341 | pci_set_drvdata(pdev, hwif); | 1267 | pci_set_drvdata(pdev, hwif); |
| 1342 | 1268 | ||
| 1343 | memset(&hw, 0, sizeof(hw)); | 1269 | memset(&hw, 0, sizeof(hw)); |
| 1344 | pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, NULL); | 1270 | pmac_ide_init_ports(&hw, pmif->regbase); |
| 1345 | hw.irq = pdev->irq; | 1271 | hw.irq = pdev->irq; |
| 1346 | hw.dev = &pdev->dev; | 1272 | hw.dev = &pdev->dev; |
| 1347 | 1273 | ||
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 634e3f6a9608..f7ede0e42881 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
| @@ -41,17 +41,6 @@ static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char | |||
| 41 | ide_hwif_t *hwif; | 41 | ide_hwif_t *hwif; |
| 42 | 42 | ||
| 43 | /* | 43 | /* |
| 44 | * Look for a hwif with matching io_base specified using | ||
| 45 | * parameters to ide_setup(). | ||
| 46 | */ | ||
| 47 | for (h = 0; h < MAX_HWIFS; ++h) { | ||
| 48 | hwif = &ide_hwifs[h]; | ||
| 49 | if (hwif->io_ports[IDE_DATA_OFFSET] == io_base) { | ||
| 50 | if (hwif->chipset == ide_forced) | ||
| 51 | return hwif; /* a perfect match */ | ||
| 52 | } | ||
| 53 | } | ||
| 54 | /* | ||
| 55 | * Look for a hwif with matching io_base default value. | 44 | * Look for a hwif with matching io_base default value. |
| 56 | * If chipset is "ide_unknown", then claim that hwif slot. | 45 | * If chipset is "ide_unknown", then claim that hwif slot. |
| 57 | * Otherwise, some other chipset has already claimed it.. :( | 46 | * Otherwise, some other chipset has already claimed it.. :( |
| @@ -356,7 +345,6 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, | |||
| 356 | unsigned long ctl = 0, base = 0; | 345 | unsigned long ctl = 0, base = 0; |
| 357 | ide_hwif_t *hwif; | 346 | ide_hwif_t *hwif; |
| 358 | u8 bootable = (d->host_flags & IDE_HFLAG_BOOTABLE) ? 1 : 0; | 347 | u8 bootable = (d->host_flags & IDE_HFLAG_BOOTABLE) ? 1 : 0; |
| 359 | u8 oldnoprobe = 0; | ||
| 360 | struct hw_regs_s hw; | 348 | struct hw_regs_s hw; |
| 361 | 349 | ||
| 362 | if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { | 350 | if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { |
| @@ -382,19 +370,13 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, | |||
| 382 | return NULL; /* no room in ide_hwifs[] */ | 370 | return NULL; /* no room in ide_hwifs[] */ |
| 383 | 371 | ||
| 384 | memset(&hw, 0, sizeof(hw)); | 372 | memset(&hw, 0, sizeof(hw)); |
| 385 | hw.irq = hwif->irq ? hwif->irq : irq; | 373 | hw.irq = irq; |
| 386 | hw.dev = &dev->dev; | 374 | hw.dev = &dev->dev; |
| 387 | hw.chipset = d->chipset ? d->chipset : ide_pci; | 375 | hw.chipset = d->chipset ? d->chipset : ide_pci; |
| 388 | ide_std_init_ports(&hw, base, ctl | 2); | 376 | ide_std_init_ports(&hw, base, ctl | 2); |
| 389 | 377 | ||
| 390 | if (hwif->io_ports[IDE_DATA_OFFSET] == base && | ||
| 391 | hwif->io_ports[IDE_CONTROL_OFFSET] == (ctl | 2)) | ||
| 392 | oldnoprobe = hwif->noprobe; | ||
| 393 | |||
| 394 | ide_init_port_hw(hwif, &hw); | 378 | ide_init_port_hw(hwif, &hw); |
| 395 | 379 | ||
| 396 | hwif->noprobe = oldnoprobe; | ||
| 397 | |||
| 398 | hwif->dev = &dev->dev; | 380 | hwif->dev = &dev->dev; |
| 399 | hwif->cds = d; | 381 | hwif->cds = d; |
| 400 | 382 | ||
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index bd8a1d14b45d..82add26cc665 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
| @@ -79,6 +79,7 @@ struct media_bay_info { | |||
| 79 | int sleeping; | 79 | int sleeping; |
| 80 | struct semaphore lock; | 80 | struct semaphore lock; |
| 81 | #ifdef CONFIG_BLK_DEV_IDE_PMAC | 81 | #ifdef CONFIG_BLK_DEV_IDE_PMAC |
| 82 | ide_hwif_t *cd_port; | ||
| 82 | void __iomem *cd_base; | 83 | void __iomem *cd_base; |
| 83 | int cd_irq; | 84 | int cd_irq; |
| 84 | int cd_retry; | 85 | int cd_retry; |
| @@ -448,7 +449,7 @@ int check_media_bay_by_base(unsigned long base, int what) | |||
| 448 | } | 449 | } |
| 449 | 450 | ||
| 450 | int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, | 451 | int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, |
| 451 | int irq, int index) | 452 | int irq, ide_hwif_t *hwif) |
| 452 | { | 453 | { |
| 453 | int i; | 454 | int i; |
| 454 | 455 | ||
| @@ -456,10 +457,11 @@ int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, | |||
| 456 | struct media_bay_info* bay = &media_bays[i]; | 457 | struct media_bay_info* bay = &media_bays[i]; |
| 457 | 458 | ||
| 458 | if (bay->mdev && which_bay == bay->mdev->ofdev.node) { | 459 | if (bay->mdev && which_bay == bay->mdev->ofdev.node) { |
| 459 | int timeout = 5000; | 460 | int timeout = 5000, index = hwif->index; |
| 460 | 461 | ||
| 461 | down(&bay->lock); | 462 | down(&bay->lock); |
| 462 | 463 | ||
| 464 | bay->cd_port = hwif; | ||
| 463 | bay->cd_base = (void __iomem *) base; | 465 | bay->cd_base = (void __iomem *) base; |
| 464 | bay->cd_irq = irq; | 466 | bay->cd_irq = irq; |
| 465 | 467 | ||
| @@ -551,15 +553,10 @@ static void media_bay_step(int i) | |||
| 551 | bay->timer = 0; | 553 | bay->timer = 0; |
| 552 | bay->state = mb_up; | 554 | bay->state = mb_up; |
| 553 | if (bay->cd_index < 0) { | 555 | if (bay->cd_index < 0) { |
| 554 | hw_regs_t hw; | ||
| 555 | |||
| 556 | printk("mediabay %d, registering IDE...\n", i); | 556 | printk("mediabay %d, registering IDE...\n", i); |
| 557 | pmu_suspend(); | 557 | pmu_suspend(); |
| 558 | ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); | 558 | ide_port_scan(bay->cd_port); |
| 559 | hw.irq = bay->cd_irq; | 559 | bay->cd_index = bay->cd_port->index; |
| 560 | hw.chipset = ide_pmac; | ||
| 561 | bay->cd_index = | ||
| 562 | ide_register_hw(&hw, NULL, NULL); | ||
| 563 | pmu_resume(); | 560 | pmu_resume(); |
| 564 | } | 561 | } |
| 565 | if (bay->cd_index == -1) { | 562 | if (bay->cd_index == -1) { |
| @@ -589,7 +586,7 @@ static void media_bay_step(int i) | |||
| 589 | if (bay->cd_index >= 0) { | 586 | if (bay->cd_index >= 0) { |
| 590 | printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, | 587 | printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, |
| 591 | bay->cd_index); | 588 | bay->cd_index); |
| 592 | ide_unregister(bay->cd_index, 1, 1); | 589 | ide_port_unregister_devices(bay->cd_port); |
| 593 | bay->cd_index = -1; | 590 | bay->cd_index = -1; |
| 594 | } | 591 | } |
| 595 | if (bay->cd_retry) { | 592 | if (bay->cd_retry) { |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 68e5c632c5d5..93c3fc20aa59 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
| @@ -60,31 +60,6 @@ | |||
| 60 | 60 | ||
| 61 | #define IDESCSI_DEBUG_LOG 0 | 61 | #define IDESCSI_DEBUG_LOG 0 |
| 62 | 62 | ||
| 63 | typedef struct idescsi_pc_s { | ||
| 64 | u8 c[12]; /* Actual packet bytes */ | ||
| 65 | int request_transfer; /* Bytes to transfer */ | ||
| 66 | int actually_transferred; /* Bytes actually transferred */ | ||
| 67 | int buffer_size; /* Size of our data buffer */ | ||
| 68 | struct request *rq; /* The corresponding request */ | ||
| 69 | u8 *buffer; /* Data buffer */ | ||
| 70 | u8 *current_position; /* Pointer into the above buffer */ | ||
| 71 | struct scatterlist *sg; /* Scatter gather table */ | ||
| 72 | unsigned int sg_cnt; /* Number of entries in sg */ | ||
| 73 | int b_count; /* Bytes transferred from current entry */ | ||
| 74 | struct scsi_cmnd *scsi_cmd; /* SCSI command */ | ||
| 75 | void (*done)(struct scsi_cmnd *); /* Scsi completion routine */ | ||
| 76 | unsigned long flags; /* Status/Action flags */ | ||
| 77 | unsigned long timeout; /* Command timeout */ | ||
| 78 | } idescsi_pc_t; | ||
| 79 | |||
| 80 | /* | ||
| 81 | * Packet command status bits. | ||
| 82 | */ | ||
| 83 | #define PC_DMA_IN_PROGRESS 0 /* 1 while DMA in progress */ | ||
| 84 | #define PC_WRITING 1 /* Data direction */ | ||
| 85 | #define PC_TIMEDOUT 3 /* command timed out */ | ||
| 86 | #define PC_DMA_OK 4 /* Use DMA */ | ||
| 87 | |||
| 88 | /* | 63 | /* |
| 89 | * SCSI command transformation layer | 64 | * SCSI command transformation layer |
| 90 | */ | 65 | */ |
| @@ -101,14 +76,15 @@ typedef struct ide_scsi_obj { | |||
| 101 | struct gendisk *disk; | 76 | struct gendisk *disk; |
| 102 | struct Scsi_Host *host; | 77 | struct Scsi_Host *host; |
| 103 | 78 | ||
| 104 | idescsi_pc_t *pc; /* Current packet command */ | 79 | struct ide_atapi_pc *pc; /* Current packet command */ |
| 105 | unsigned long flags; /* Status/Action flags */ | 80 | unsigned long flags; /* Status/Action flags */ |
| 106 | unsigned long transform; /* SCSI cmd translation layer */ | 81 | unsigned long transform; /* SCSI cmd translation layer */ |
| 107 | unsigned long log; /* log flags */ | 82 | unsigned long log; /* log flags */ |
| 108 | } idescsi_scsi_t; | 83 | } idescsi_scsi_t; |
| 109 | 84 | ||
| 110 | static DEFINE_MUTEX(idescsi_ref_mutex); | 85 | static DEFINE_MUTEX(idescsi_ref_mutex); |
| 111 | static int idescsi_nocd; /* Set by module param to skip cd */ | 86 | /* Set by module param to skip cd */ |
| 87 | static int idescsi_nocd; | ||
| 112 | 88 | ||
| 113 | #define ide_scsi_g(disk) \ | 89 | #define ide_scsi_g(disk) \ |
| 114 | container_of((disk)->private_data, struct ide_scsi_obj, driver) | 90 | container_of((disk)->private_data, struct ide_scsi_obj, driver) |
| @@ -152,22 +128,11 @@ static inline idescsi_scsi_t *drive_to_idescsi(ide_drive_t *ide_drive) | |||
| 152 | */ | 128 | */ |
| 153 | #define IDESCSI_PC_RQ 90 | 129 | #define IDESCSI_PC_RQ 90 |
| 154 | 130 | ||
| 155 | static void idescsi_discard_data (ide_drive_t *drive, unsigned int bcount) | ||
| 156 | { | ||
| 157 | while (bcount--) | ||
| 158 | (void) HWIF(drive)->INB(IDE_DATA_REG); | ||
| 159 | } | ||
| 160 | |||
| 161 | static void idescsi_output_zeros (ide_drive_t *drive, unsigned int bcount) | ||
| 162 | { | ||
| 163 | while (bcount--) | ||
| 164 | HWIF(drive)->OUTB(0, IDE_DATA_REG); | ||
| 165 | } | ||
| 166 | |||
| 167 | /* | 131 | /* |
| 168 | * PIO data transfer routines using the scatter gather table. | 132 | * PIO data transfer routines using the scatter gather table. |
| 169 | */ | 133 | */ |
| 170 | static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount) | 134 | static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 135 | unsigned int bcount) | ||
| 171 | { | 136 | { |
| 172 | int count; | 137 | int count; |
| 173 | char *buf; | 138 | char *buf; |
| @@ -200,11 +165,12 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne | |||
| 200 | 165 | ||
| 201 | if (bcount) { | 166 | if (bcount) { |
| 202 | printk (KERN_ERR "ide-scsi: scatter gather table too small, discarding data\n"); | 167 | printk (KERN_ERR "ide-scsi: scatter gather table too small, discarding data\n"); |
| 203 | idescsi_discard_data (drive, bcount); | 168 | ide_atapi_discard_data(drive, bcount); |
| 204 | } | 169 | } |
| 205 | } | 170 | } |
| 206 | 171 | ||
| 207 | static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount) | 172 | static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 173 | unsigned int bcount) | ||
| 208 | { | 174 | { |
| 209 | int count; | 175 | int count; |
| 210 | char *buf; | 176 | char *buf; |
| @@ -237,7 +203,7 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign | |||
| 237 | 203 | ||
| 238 | if (bcount) { | 204 | if (bcount) { |
| 239 | printk (KERN_ERR "ide-scsi: scatter gather table too small, padding with zeros\n"); | 205 | printk (KERN_ERR "ide-scsi: scatter gather table too small, padding with zeros\n"); |
| 240 | idescsi_output_zeros (drive, bcount); | 206 | ide_atapi_write_zeros(drive, bcount); |
| 241 | } | 207 | } |
| 242 | } | 208 | } |
| 243 | 209 | ||
| @@ -246,15 +212,16 @@ static void ide_scsi_hex_dump(u8 *data, int len) | |||
| 246 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0); | 212 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0); |
| 247 | } | 213 | } |
| 248 | 214 | ||
| 249 | static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) | 215 | static int idescsi_check_condition(ide_drive_t *drive, |
| 216 | struct request *failed_cmd) | ||
| 250 | { | 217 | { |
| 251 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 218 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
| 252 | idescsi_pc_t *pc; | 219 | struct ide_atapi_pc *pc; |
| 253 | struct request *rq; | 220 | struct request *rq; |
| 254 | u8 *buf; | 221 | u8 *buf; |
| 255 | 222 | ||
| 256 | /* stuff a sense request in front of our current request */ | 223 | /* stuff a sense request in front of our current request */ |
| 257 | pc = kzalloc(sizeof(idescsi_pc_t), GFP_ATOMIC); | 224 | pc = kzalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC); |
| 258 | rq = kmalloc(sizeof(struct request), GFP_ATOMIC); | 225 | rq = kmalloc(sizeof(struct request), GFP_ATOMIC); |
| 259 | buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); | 226 | buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); |
| 260 | if (!pc || !rq || !buf) { | 227 | if (!pc || !rq || !buf) { |
| @@ -266,14 +233,14 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co | |||
| 266 | ide_init_drive_cmd(rq); | 233 | ide_init_drive_cmd(rq); |
| 267 | rq->special = (char *) pc; | 234 | rq->special = (char *) pc; |
| 268 | pc->rq = rq; | 235 | pc->rq = rq; |
| 269 | pc->buffer = buf; | 236 | pc->buf = buf; |
| 270 | pc->c[0] = REQUEST_SENSE; | 237 | pc->c[0] = REQUEST_SENSE; |
| 271 | pc->c[4] = pc->request_transfer = pc->buffer_size = SCSI_SENSE_BUFFERSIZE; | 238 | pc->c[4] = pc->req_xfer = pc->buf_size = SCSI_SENSE_BUFFERSIZE; |
| 272 | rq->cmd_type = REQ_TYPE_SENSE; | 239 | rq->cmd_type = REQ_TYPE_SENSE; |
| 273 | pc->timeout = jiffies + WAIT_READY; | 240 | pc->timeout = jiffies + WAIT_READY; |
| 274 | /* NOTE! Save the failed packet command in "rq->buffer" */ | 241 | /* NOTE! Save the failed packet command in "rq->buffer" */ |
| 275 | rq->buffer = (void *) failed_command->special; | 242 | rq->buffer = (void *) failed_cmd->special; |
| 276 | pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; | 243 | pc->scsi_cmd = ((struct ide_atapi_pc *) failed_cmd->special)->scsi_cmd; |
| 277 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { | 244 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { |
| 278 | printk ("ide-scsi: %s: queue cmd = ", drive->name); | 245 | printk ("ide-scsi: %s: queue cmd = ", drive->name); |
| 279 | ide_scsi_hex_dump(pc->c, 6); | 246 | ide_scsi_hex_dump(pc->c, 6); |
| @@ -287,9 +254,12 @@ static int idescsi_end_request(ide_drive_t *, int, int); | |||
| 287 | static ide_startstop_t | 254 | static ide_startstop_t |
| 288 | idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err) | 255 | idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err) |
| 289 | { | 256 | { |
| 257 | ide_hwif_t *hwif = drive->hwif; | ||
| 258 | |||
| 290 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 259 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) |
| 291 | /* force an abort */ | 260 | /* force an abort */ |
| 292 | HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG); | 261 | hwif->OUTB(WIN_IDLEIMMEDIATE, |
| 262 | hwif->io_ports[IDE_COMMAND_OFFSET]); | ||
| 293 | 263 | ||
| 294 | rq->errors++; | 264 | rq->errors++; |
| 295 | 265 | ||
| @@ -303,7 +273,7 @@ idescsi_atapi_abort(ide_drive_t *drive, struct request *rq) | |||
| 303 | { | 273 | { |
| 304 | #if IDESCSI_DEBUG_LOG | 274 | #if IDESCSI_DEBUG_LOG |
| 305 | printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n", | 275 | printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n", |
| 306 | ((idescsi_pc_t *) rq->special)->scsi_cmd->serial_number); | 276 | ((struct ide_atapi_pc *) rq->special)->scsi_cmd->serial_number); |
| 307 | #endif | 277 | #endif |
| 308 | rq->errors |= ERROR_MAX; | 278 | rq->errors |= ERROR_MAX; |
| 309 | 279 | ||
| @@ -316,7 +286,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
| 316 | { | 286 | { |
| 317 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 287 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
| 318 | struct request *rq = HWGROUP(drive)->rq; | 288 | struct request *rq = HWGROUP(drive)->rq; |
| 319 | idescsi_pc_t *pc = (idescsi_pc_t *) rq->special; | 289 | struct ide_atapi_pc *pc = (struct ide_atapi_pc *) rq->special; |
| 320 | int log = test_bit(IDESCSI_LOG_CMD, &scsi->log); | 290 | int log = test_bit(IDESCSI_LOG_CMD, &scsi->log); |
| 321 | struct Scsi_Host *host; | 291 | struct Scsi_Host *host; |
| 322 | int errors = rq->errors; | 292 | int errors = rq->errors; |
| @@ -328,20 +298,23 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
| 328 | } | 298 | } |
| 329 | ide_end_drive_cmd (drive, 0, 0); | 299 | ide_end_drive_cmd (drive, 0, 0); |
| 330 | if (blk_sense_request(rq)) { | 300 | if (blk_sense_request(rq)) { |
| 331 | idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; | 301 | struct ide_atapi_pc *opc = (struct ide_atapi_pc *) rq->buffer; |
| 332 | if (log) { | 302 | if (log) { |
| 333 | printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); | 303 | printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); |
| 334 | ide_scsi_hex_dump(pc->buffer, 16); | 304 | ide_scsi_hex_dump(pc->buf, 16); |
| 335 | } | 305 | } |
| 336 | memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); | 306 | memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buf, |
| 337 | kfree(pc->buffer); | 307 | SCSI_SENSE_BUFFERSIZE); |
| 308 | kfree(pc->buf); | ||
| 338 | kfree(pc); | 309 | kfree(pc); |
| 339 | kfree(rq); | 310 | kfree(rq); |
| 340 | pc = opc; | 311 | pc = opc; |
| 341 | rq = pc->rq; | 312 | rq = pc->rq; |
| 342 | pc->scsi_cmd->result = (CHECK_CONDITION << 1) | | 313 | pc->scsi_cmd->result = (CHECK_CONDITION << 1) | |
| 343 | ((test_bit(PC_TIMEDOUT, &pc->flags)?DID_TIME_OUT:DID_OK) << 16); | 314 | (((pc->flags & PC_FLAG_TIMEDOUT) ? |
| 344 | } else if (test_bit(PC_TIMEDOUT, &pc->flags)) { | 315 | DID_TIME_OUT : |
| 316 | DID_OK) << 16); | ||
| 317 | } else if (pc->flags & PC_FLAG_TIMEDOUT) { | ||
| 345 | if (log) | 318 | if (log) |
| 346 | printk (KERN_WARNING "ide-scsi: %s: timed out for %lu\n", | 319 | printk (KERN_WARNING "ide-scsi: %s: timed out for %lu\n", |
| 347 | drive->name, pc->scsi_cmd->serial_number); | 320 | drive->name, pc->scsi_cmd->serial_number); |
| @@ -370,7 +343,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
| 370 | return 0; | 343 | return 0; |
| 371 | } | 344 | } |
| 372 | 345 | ||
| 373 | static inline unsigned long get_timeout(idescsi_pc_t *pc) | 346 | static inline unsigned long get_timeout(struct ide_atapi_pc *pc) |
| 374 | { | 347 | { |
| 375 | return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); | 348 | return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); |
| 376 | } | 349 | } |
| @@ -378,12 +351,12 @@ static inline unsigned long get_timeout(idescsi_pc_t *pc) | |||
| 378 | static int idescsi_expiry(ide_drive_t *drive) | 351 | static int idescsi_expiry(ide_drive_t *drive) |
| 379 | { | 352 | { |
| 380 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 353 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
| 381 | idescsi_pc_t *pc = scsi->pc; | 354 | struct ide_atapi_pc *pc = scsi->pc; |
| 382 | 355 | ||
| 383 | #if IDESCSI_DEBUG_LOG | 356 | #if IDESCSI_DEBUG_LOG |
| 384 | printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); | 357 | printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); |
| 385 | #endif | 358 | #endif |
| 386 | set_bit(PC_TIMEDOUT, &pc->flags); | 359 | pc->flags |= PC_FLAG_TIMEDOUT; |
| 387 | 360 | ||
| 388 | return 0; /* we do not want the ide subsystem to retry */ | 361 | return 0; /* we do not want the ide subsystem to retry */ |
| 389 | } | 362 | } |
| @@ -395,7 +368,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
| 395 | { | 368 | { |
| 396 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 369 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
| 397 | ide_hwif_t *hwif = drive->hwif; | 370 | ide_hwif_t *hwif = drive->hwif; |
| 398 | idescsi_pc_t *pc = scsi->pc; | 371 | struct ide_atapi_pc *pc = scsi->pc; |
| 399 | struct request *rq = pc->rq; | 372 | struct request *rq = pc->rq; |
| 400 | unsigned int temp; | 373 | unsigned int temp; |
| 401 | u16 bcount; | 374 | u16 bcount; |
| @@ -405,7 +378,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
| 405 | printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); | 378 | printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); |
| 406 | #endif /* IDESCSI_DEBUG_LOG */ | 379 | #endif /* IDESCSI_DEBUG_LOG */ |
| 407 | 380 | ||
| 408 | if (test_bit(PC_TIMEDOUT, &pc->flags)){ | 381 | if (pc->flags & PC_FLAG_TIMEDOUT) { |
| 409 | #if IDESCSI_DEBUG_LOG | 382 | #if IDESCSI_DEBUG_LOG |
| 410 | printk(KERN_WARNING "idescsi_pc_intr: got timed out packet %lu at %lu\n", | 383 | printk(KERN_WARNING "idescsi_pc_intr: got timed out packet %lu at %lu\n", |
| 411 | pc->scsi_cmd->serial_number, jiffies); | 384 | pc->scsi_cmd->serial_number, jiffies); |
| @@ -414,11 +387,12 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
| 414 | idescsi_end_request (drive, 1, 0); | 387 | idescsi_end_request (drive, 1, 0); |
| 415 | return ide_stopped; | 388 | return ide_stopped; |
| 416 | } | 389 | } |
| 417 | if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { | 390 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { |
| 391 | pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; | ||
| 418 | #if IDESCSI_DEBUG_LOG | 392 | #if IDESCSI_DEBUG_LOG |
| 419 | printk ("ide-scsi: %s: DMA complete\n", drive->name); | 393 | printk ("ide-scsi: %s: DMA complete\n", drive->name); |
| 420 | #endif /* IDESCSI_DEBUG_LOG */ | 394 | #endif /* IDESCSI_DEBUG_LOG */ |
| 421 | pc->actually_transferred=pc->request_transfer; | 395 | pc->xferred = pc->req_xfer; |
| 422 | (void) HWIF(drive)->ide_dma_end(drive); | 396 | (void) HWIF(drive)->ide_dma_end(drive); |
| 423 | } | 397 | } |
| 424 | 398 | ||
| @@ -428,42 +402,44 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
| 428 | if ((stat & DRQ_STAT) == 0) { | 402 | if ((stat & DRQ_STAT) == 0) { |
| 429 | /* No more interrupts */ | 403 | /* No more interrupts */ |
| 430 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) | 404 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) |
| 431 | printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred); | 405 | printk(KERN_INFO "Packet command completed, %d bytes" |
| 406 | " transferred\n", pc->xferred); | ||
| 432 | local_irq_enable_in_hardirq(); | 407 | local_irq_enable_in_hardirq(); |
| 433 | if (stat & ERR_STAT) | 408 | if (stat & ERR_STAT) |
| 434 | rq->errors++; | 409 | rq->errors++; |
| 435 | idescsi_end_request (drive, 1, 0); | 410 | idescsi_end_request (drive, 1, 0); |
| 436 | return ide_stopped; | 411 | return ide_stopped; |
| 437 | } | 412 | } |
| 438 | bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | | 413 | bcount = (hwif->INB(hwif->io_ports[IDE_BCOUNTH_OFFSET]) << 8) | |
| 439 | hwif->INB(IDE_BCOUNTL_REG); | 414 | hwif->INB(hwif->io_ports[IDE_BCOUNTL_OFFSET]); |
| 440 | ireason = hwif->INB(IDE_IREASON_REG); | 415 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); |
| 441 | 416 | ||
| 442 | if (ireason & CD) { | 417 | if (ireason & CD) { |
| 443 | printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n"); | 418 | printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n"); |
| 444 | return ide_do_reset (drive); | 419 | return ide_do_reset (drive); |
| 445 | } | 420 | } |
| 446 | if (ireason & IO) { | 421 | if (ireason & IO) { |
| 447 | temp = pc->actually_transferred + bcount; | 422 | temp = pc->xferred + bcount; |
| 448 | if (temp > pc->request_transfer) { | 423 | if (temp > pc->req_xfer) { |
| 449 | if (temp > pc->buffer_size) { | 424 | if (temp > pc->buf_size) { |
| 450 | printk(KERN_ERR "ide-scsi: The scsi wants to " | 425 | printk(KERN_ERR "ide-scsi: The scsi wants to " |
| 451 | "send us more data than expected " | 426 | "send us more data than expected " |
| 452 | "- discarding data\n"); | 427 | "- discarding data\n"); |
| 453 | temp = pc->buffer_size - pc->actually_transferred; | 428 | temp = pc->buf_size - pc->xferred; |
| 454 | if (temp) { | 429 | if (temp) { |
| 455 | clear_bit(PC_WRITING, &pc->flags); | 430 | pc->flags &= ~PC_FLAG_WRITING; |
| 456 | if (pc->sg) | 431 | if (pc->sg) |
| 457 | idescsi_input_buffers(drive, pc, temp); | 432 | idescsi_input_buffers(drive, pc, |
| 433 | temp); | ||
| 458 | else | 434 | else |
| 459 | drive->hwif->atapi_input_bytes(drive, pc->current_position, temp); | 435 | drive->hwif->atapi_input_bytes(drive, pc->cur_pos, temp); |
| 460 | printk(KERN_ERR "ide-scsi: transferred" | 436 | printk(KERN_ERR "ide-scsi: transferred" |
| 461 | " %d of %d bytes\n", | 437 | " %d of %d bytes\n", |
| 462 | temp, bcount); | 438 | temp, bcount); |
| 463 | } | 439 | } |
| 464 | pc->actually_transferred += temp; | 440 | pc->xferred += temp; |
| 465 | pc->current_position += temp; | 441 | pc->cur_pos += temp; |
| 466 | idescsi_discard_data(drive, bcount - temp); | 442 | ide_atapi_discard_data(drive, bcount - temp); |
| 467 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 443 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
| 468 | return ide_started; | 444 | return ide_started; |
| 469 | } | 445 | } |
| @@ -473,23 +449,23 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
| 473 | } | 449 | } |
| 474 | } | 450 | } |
| 475 | if (ireason & IO) { | 451 | if (ireason & IO) { |
| 476 | clear_bit(PC_WRITING, &pc->flags); | 452 | pc->flags &= ~PC_FLAG_WRITING; |
| 477 | if (pc->sg) | 453 | if (pc->sg) |
| 478 | idescsi_input_buffers(drive, pc, bcount); | 454 | idescsi_input_buffers(drive, pc, bcount); |
| 479 | else | 455 | else |
| 480 | hwif->atapi_input_bytes(drive, pc->current_position, | 456 | hwif->atapi_input_bytes(drive, pc->cur_pos, |
| 481 | bcount); | 457 | bcount); |
| 482 | } else { | 458 | } else { |
| 483 | set_bit(PC_WRITING, &pc->flags); | 459 | pc->flags |= PC_FLAG_WRITING; |
| 484 | if (pc->sg) | 460 | if (pc->sg) |
| 485 | idescsi_output_buffers(drive, pc, bcount); | 461 | idescsi_output_buffers(drive, pc, bcount); |
| 486 | else | 462 | else |
| 487 | hwif->atapi_output_bytes(drive, pc->current_position, | 463 | hwif->atapi_output_bytes(drive, pc->cur_pos, |
| 488 | bcount); | 464 | bcount); |
| 489 | } | 465 | } |
| 490 | /* Update the current position */ | 466 | /* Update the current position */ |
| 491 | pc->actually_transferred += bcount; | 467 | pc->xferred += bcount; |
| 492 | pc->current_position += bcount; | 468 | pc->cur_pos += bcount; |
| 493 | 469 | ||
| 494 | /* And set the interrupt handler again */ | 470 | /* And set the interrupt handler again */ |
| 495 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 471 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
| @@ -500,7 +476,7 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) | |||
| 500 | { | 476 | { |
| 501 | ide_hwif_t *hwif = drive->hwif; | 477 | ide_hwif_t *hwif = drive->hwif; |
| 502 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 478 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
| 503 | idescsi_pc_t *pc = scsi->pc; | 479 | struct ide_atapi_pc *pc = scsi->pc; |
| 504 | ide_startstop_t startstop; | 480 | ide_startstop_t startstop; |
| 505 | u8 ireason; | 481 | u8 ireason; |
| 506 | 482 | ||
| @@ -509,7 +485,7 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) | |||
| 509 | "initiated yet DRQ isn't asserted\n"); | 485 | "initiated yet DRQ isn't asserted\n"); |
| 510 | return startstop; | 486 | return startstop; |
| 511 | } | 487 | } |
| 512 | ireason = hwif->INB(IDE_IREASON_REG); | 488 | ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); |
| 513 | if ((ireason & CD) == 0 || (ireason & IO)) { | 489 | if ((ireason & CD) == 0 || (ireason & IO)) { |
| 514 | printk(KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while " | 490 | printk(KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while " |
| 515 | "issuing a packet command\n"); | 491 | "issuing a packet command\n"); |
| @@ -520,34 +496,34 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) | |||
| 520 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 496 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
| 521 | /* Send the actual packet */ | 497 | /* Send the actual packet */ |
| 522 | drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12); | 498 | drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12); |
| 523 | if (test_bit (PC_DMA_OK, &pc->flags)) { | 499 | if (pc->flags & PC_FLAG_DMA_OK) { |
| 524 | set_bit (PC_DMA_IN_PROGRESS, &pc->flags); | 500 | pc->flags |= PC_FLAG_DMA_IN_PROGRESS; |
| 525 | hwif->dma_start(drive); | 501 | hwif->dma_start(drive); |
| 526 | } | 502 | } |
| 527 | return ide_started; | 503 | return ide_started; |
| 528 | } | 504 | } |
| 529 | 505 | ||
| 530 | static inline int idescsi_set_direction(idescsi_pc_t *pc) | 506 | static inline int idescsi_set_direction(struct ide_atapi_pc *pc) |
| 531 | { | 507 | { |
| 532 | switch (pc->c[0]) { | 508 | switch (pc->c[0]) { |
| 533 | case READ_6: case READ_10: case READ_12: | 509 | case READ_6: case READ_10: case READ_12: |
| 534 | clear_bit(PC_WRITING, &pc->flags); | 510 | pc->flags &= ~PC_FLAG_WRITING; |
| 535 | return 0; | 511 | return 0; |
| 536 | case WRITE_6: case WRITE_10: case WRITE_12: | 512 | case WRITE_6: case WRITE_10: case WRITE_12: |
| 537 | set_bit(PC_WRITING, &pc->flags); | 513 | pc->flags |= PC_FLAG_WRITING; |
| 538 | return 0; | 514 | return 0; |
| 539 | default: | 515 | default: |
| 540 | return 1; | 516 | return 1; |
| 541 | } | 517 | } |
| 542 | } | 518 | } |
| 543 | 519 | ||
| 544 | static int idescsi_map_sg(ide_drive_t *drive, idescsi_pc_t *pc) | 520 | static int idescsi_map_sg(ide_drive_t *drive, struct ide_atapi_pc *pc) |
| 545 | { | 521 | { |
| 546 | ide_hwif_t *hwif = drive->hwif; | 522 | ide_hwif_t *hwif = drive->hwif; |
| 547 | struct scatterlist *sg, *scsi_sg; | 523 | struct scatterlist *sg, *scsi_sg; |
| 548 | int segments; | 524 | int segments; |
| 549 | 525 | ||
| 550 | if (!pc->request_transfer || pc->request_transfer % 1024) | 526 | if (!pc->req_xfer || pc->req_xfer % 1024) |
| 551 | return 1; | 527 | return 1; |
| 552 | 528 | ||
| 553 | if (idescsi_set_direction(pc)) | 529 | if (idescsi_set_direction(pc)) |
| @@ -566,21 +542,21 @@ static int idescsi_map_sg(ide_drive_t *drive, idescsi_pc_t *pc) | |||
| 566 | return 0; | 542 | return 0; |
| 567 | } | 543 | } |
| 568 | 544 | ||
| 569 | /* | 545 | static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive, |
| 570 | * Issue a packet command | 546 | struct ide_atapi_pc *pc) |
| 571 | */ | ||
| 572 | static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) | ||
| 573 | { | 547 | { |
| 574 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 548 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
| 575 | ide_hwif_t *hwif = drive->hwif; | 549 | ide_hwif_t *hwif = drive->hwif; |
| 576 | u16 bcount; | 550 | u16 bcount; |
| 577 | u8 dma = 0; | 551 | u8 dma = 0; |
| 578 | 552 | ||
| 579 | scsi->pc=pc; /* Set the current packet command */ | 553 | /* Set the current packet command */ |
| 580 | pc->actually_transferred=0; /* We haven't transferred any data yet */ | 554 | scsi->pc = pc; |
| 581 | pc->current_position=pc->buffer; | 555 | /* We haven't transferred any data yet */ |
| 556 | pc->xferred = 0; | ||
| 557 | pc->cur_pos = pc->buf; | ||
| 582 | /* Request to transfer the entire buffer at once */ | 558 | /* Request to transfer the entire buffer at once */ |
| 583 | bcount = min(pc->request_transfer, 63 * 1024); | 559 | bcount = min(pc->req_xfer, 63 * 1024); |
| 584 | 560 | ||
| 585 | if (drive->using_dma && !idescsi_map_sg(drive, pc)) { | 561 | if (drive->using_dma && !idescsi_map_sg(drive, pc)) { |
| 586 | hwif->sg_mapped = 1; | 562 | hwif->sg_mapped = 1; |
| @@ -591,7 +567,7 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) | |||
| 591 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma); | 567 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma); |
| 592 | 568 | ||
| 593 | if (dma) | 569 | if (dma) |
| 594 | set_bit(PC_DMA_OK, &pc->flags); | 570 | pc->flags |= PC_FLAG_DMA_OK; |
| 595 | 571 | ||
| 596 | if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { | 572 | if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { |
| 597 | ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc, | 573 | ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc, |
| @@ -599,7 +575,7 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) | |||
| 599 | return ide_started; | 575 | return ide_started; |
| 600 | } else { | 576 | } else { |
| 601 | /* Issue the packet command */ | 577 | /* Issue the packet command */ |
| 602 | HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG); | 578 | hwif->OUTB(WIN_PACKETCMD, hwif->io_ports[IDE_COMMAND_OFFSET]); |
| 603 | return idescsi_transfer_pc(drive); | 579 | return idescsi_transfer_pc(drive); |
| 604 | } | 580 | } |
| 605 | } | 581 | } |
| @@ -615,7 +591,8 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r | |||
| 615 | #endif /* IDESCSI_DEBUG_LOG */ | 591 | #endif /* IDESCSI_DEBUG_LOG */ |
| 616 | 592 | ||
| 617 | if (blk_sense_request(rq) || blk_special_request(rq)) { | 593 | if (blk_sense_request(rq) || blk_special_request(rq)) { |
| 618 | return idescsi_issue_pc (drive, (idescsi_pc_t *) rq->special); | 594 | return idescsi_issue_pc(drive, |
| 595 | (struct ide_atapi_pc *) rq->special); | ||
| 619 | } | 596 | } |
| 620 | blk_dump_rq_flags(rq, "ide-scsi: unsup command"); | 597 | blk_dump_rq_flags(rq, "ide-scsi: unsup command"); |
| 621 | idescsi_end_request (drive, 0, 0); | 598 | idescsi_end_request (drive, 0, 0); |
| @@ -773,15 +750,15 @@ static int idescsi_queue (struct scsi_cmnd *cmd, | |||
| 773 | idescsi_scsi_t *scsi = scsihost_to_idescsi(host); | 750 | idescsi_scsi_t *scsi = scsihost_to_idescsi(host); |
| 774 | ide_drive_t *drive = scsi->drive; | 751 | ide_drive_t *drive = scsi->drive; |
| 775 | struct request *rq = NULL; | 752 | struct request *rq = NULL; |
| 776 | idescsi_pc_t *pc = NULL; | 753 | struct ide_atapi_pc *pc = NULL; |
| 777 | 754 | ||
| 778 | if (!drive) { | 755 | if (!drive) { |
| 779 | scmd_printk (KERN_ERR, cmd, "drive not present\n"); | 756 | scmd_printk (KERN_ERR, cmd, "drive not present\n"); |
| 780 | goto abort; | 757 | goto abort; |
| 781 | } | 758 | } |
| 782 | scsi = drive_to_idescsi(drive); | 759 | scsi = drive_to_idescsi(drive); |
| 783 | pc = kmalloc (sizeof (idescsi_pc_t), GFP_ATOMIC); | 760 | pc = kmalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC); |
| 784 | rq = kmalloc (sizeof (struct request), GFP_ATOMIC); | 761 | rq = kmalloc(sizeof(struct request), GFP_ATOMIC); |
| 785 | if (rq == NULL || pc == NULL) { | 762 | if (rq == NULL || pc == NULL) { |
| 786 | printk (KERN_ERR "ide-scsi: %s: out of memory\n", drive->name); | 763 | printk (KERN_ERR "ide-scsi: %s: out of memory\n", drive->name); |
| 787 | goto abort; | 764 | goto abort; |
| @@ -791,11 +768,11 @@ static int idescsi_queue (struct scsi_cmnd *cmd, | |||
| 791 | pc->flags = 0; | 768 | pc->flags = 0; |
| 792 | pc->rq = rq; | 769 | pc->rq = rq; |
| 793 | memcpy (pc->c, cmd->cmnd, cmd->cmd_len); | 770 | memcpy (pc->c, cmd->cmnd, cmd->cmd_len); |
| 794 | pc->buffer = NULL; | 771 | pc->buf = NULL; |
| 795 | pc->sg = scsi_sglist(cmd); | 772 | pc->sg = scsi_sglist(cmd); |
| 796 | pc->sg_cnt = scsi_sg_count(cmd); | 773 | pc->sg_cnt = scsi_sg_count(cmd); |
| 797 | pc->b_count = 0; | 774 | pc->b_count = 0; |
| 798 | pc->request_transfer = pc->buffer_size = scsi_bufflen(cmd); | 775 | pc->req_xfer = pc->buf_size = scsi_bufflen(cmd); |
| 799 | pc->scsi_cmd = cmd; | 776 | pc->scsi_cmd = cmd; |
| 800 | pc->done = done; | 777 | pc->done = done; |
| 801 | pc->timeout = jiffies + cmd->timeout_per_command; | 778 | pc->timeout = jiffies + cmd->timeout_per_command; |
| @@ -866,7 +843,7 @@ static int idescsi_eh_abort (struct scsi_cmnd *cmd) | |||
| 866 | printk (KERN_ERR "ide-scsi: cmd aborted!\n"); | 843 | printk (KERN_ERR "ide-scsi: cmd aborted!\n"); |
| 867 | 844 | ||
| 868 | if (blk_sense_request(scsi->pc->rq)) | 845 | if (blk_sense_request(scsi->pc->rq)) |
| 869 | kfree(scsi->pc->buffer); | 846 | kfree(scsi->pc->buf); |
| 870 | kfree(scsi->pc->rq); | 847 | kfree(scsi->pc->rq); |
| 871 | kfree(scsi->pc); | 848 | kfree(scsi->pc); |
| 872 | scsi->pc = NULL; | 849 | scsi->pc = NULL; |
| @@ -916,7 +893,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) | |||
| 916 | if (__blk_end_request(req, -EIO, 0)) | 893 | if (__blk_end_request(req, -EIO, 0)) |
| 917 | BUG(); | 894 | BUG(); |
| 918 | if (blk_sense_request(req)) | 895 | if (blk_sense_request(req)) |
| 919 | kfree(scsi->pc->buffer); | 896 | kfree(scsi->pc->buf); |
| 920 | kfree(scsi->pc); | 897 | kfree(scsi->pc); |
| 921 | scsi->pc = NULL; | 898 | scsi->pc = NULL; |
| 922 | kfree(req); | 899 | kfree(req); |
diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h index b7bf68d0407b..f44129abc02c 100644 --- a/include/asm-alpha/ide.h +++ b/include/asm-alpha/ide.h | |||
| @@ -13,9 +13,6 @@ | |||
| 13 | 13 | ||
| 14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
| 15 | 15 | ||
| 16 | |||
| 17 | #define IDE_ARCH_OBSOLETE_DEFAULTS | ||
| 18 | |||
| 19 | static inline int ide_default_irq(unsigned long base) | 16 | static inline int ide_default_irq(unsigned long base) |
| 20 | { | 17 | { |
| 21 | switch (base) { | 18 | switch (base) { |
| @@ -40,14 +37,6 @@ static inline unsigned long ide_default_io_base(int index) | |||
| 40 | } | 37 | } |
| 41 | } | 38 | } |
| 42 | 39 | ||
| 43 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 44 | |||
| 45 | #ifdef CONFIG_PCI | ||
| 46 | #define ide_init_default_irq(base) (0) | ||
| 47 | #else | ||
| 48 | #define ide_init_default_irq(base) ide_default_irq(base) | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #include <asm-generic/ide_iops.h> | 40 | #include <asm-generic/ide_iops.h> |
| 52 | 41 | ||
| 53 | #endif /* __KERNEL__ */ | 42 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h index f348fcf3150b..88f4d231ce4f 100644 --- a/include/asm-arm/ide.h +++ b/include/asm-arm/ide.h | |||
| @@ -17,14 +17,6 @@ | |||
| 17 | #define MAX_HWIFS 4 | 17 | #define MAX_HWIFS 4 |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | #if !defined(CONFIG_ARCH_L7200) | ||
| 21 | # ifdef CONFIG_ARCH_CLPS7500 | ||
| 22 | # define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 23 | # else | ||
| 24 | # define ide_default_io_ctl(base) (0) | ||
| 25 | # endif | ||
| 26 | #endif /* !ARCH_L7200 */ | ||
| 27 | |||
| 28 | #define __ide_mm_insw(port,addr,len) readsw(port,addr,len) | 20 | #define __ide_mm_insw(port,addr,len) readsw(port,addr,len) |
| 29 | #define __ide_mm_insl(port,addr,len) readsl(port,addr,len) | 21 | #define __ide_mm_insl(port,addr,len) readsl(port,addr,len) |
| 30 | #define __ide_mm_outsw(port,addr,len) writesw(port,addr,len) | 22 | #define __ide_mm_outsw(port,addr,len) writesw(port,addr,len) |
diff --git a/include/asm-blackfin/ide.h b/include/asm-blackfin/ide.h index 121e272581d6..5b88de115bf4 100644 --- a/include/asm-blackfin/ide.h +++ b/include/asm-blackfin/ide.h | |||
| @@ -19,10 +19,6 @@ | |||
| 19 | 19 | ||
| 20 | #define MAX_HWIFS 1 | 20 | #define MAX_HWIFS 1 |
| 21 | 21 | ||
| 22 | /* Legacy ... BLK_DEV_IDECS */ | ||
| 23 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 24 | |||
| 25 | |||
| 26 | #include <asm-generic/ide_iops.h> | 22 | #include <asm-generic/ide_iops.h> |
| 27 | 23 | ||
| 28 | /****************************************************************************/ | 24 | /****************************************************************************/ |
diff --git a/include/asm-ia64/ide.h b/include/asm-ia64/ide.h index 1ccf23809329..8fa3f8cd067a 100644 --- a/include/asm-ia64/ide.h +++ b/include/asm-ia64/ide.h | |||
| @@ -16,8 +16,6 @@ | |||
| 16 | 16 | ||
| 17 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
| 18 | 18 | ||
| 19 | #define IDE_ARCH_OBSOLETE_DEFAULTS | ||
| 20 | |||
| 21 | static inline int ide_default_irq(unsigned long base) | 19 | static inline int ide_default_irq(unsigned long base) |
| 22 | { | 20 | { |
| 23 | switch (base) { | 21 | switch (base) { |
| @@ -46,14 +44,6 @@ static inline unsigned long ide_default_io_base(int index) | |||
| 46 | } | 44 | } |
| 47 | } | 45 | } |
| 48 | 46 | ||
| 49 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 50 | |||
| 51 | #ifdef CONFIG_PCI | ||
| 52 | #define ide_init_default_irq(base) (0) | ||
| 53 | #else | ||
| 54 | #define ide_init_default_irq(base) ide_default_irq(base) | ||
| 55 | #endif | ||
| 56 | |||
| 57 | #include <asm-generic/ide_iops.h> | 47 | #include <asm-generic/ide_iops.h> |
| 58 | 48 | ||
| 59 | #endif /* __KERNEL__ */ | 49 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h index 5d2044e529ab..1e7f6474d130 100644 --- a/include/asm-m32r/ide.h +++ b/include/asm-m32r/ide.h | |||
| @@ -23,8 +23,6 @@ | |||
| 23 | # endif | 23 | # endif |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | #define IDE_ARCH_OBSOLETE_DEFAULTS | ||
| 27 | |||
| 28 | static __inline__ int ide_default_irq(unsigned long base) | 26 | static __inline__ int ide_default_irq(unsigned long base) |
| 29 | { | 27 | { |
| 30 | switch (base) { | 28 | switch (base) { |
| @@ -65,14 +63,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 65 | } | 63 | } |
| 66 | } | 64 | } |
| 67 | 65 | ||
| 68 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 69 | |||
| 70 | #ifdef CONFIG_BLK_DEV_IDEPCI | ||
| 71 | #define ide_init_default_irq(base) (0) | ||
| 72 | #else | ||
| 73 | #define ide_init_default_irq(base) ide_default_irq(base) | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #include <asm-generic/ide_iops.h> | 66 | #include <asm-generic/ide_iops.h> |
| 77 | 67 | ||
| 78 | #endif /* __KERNEL__ */ | 68 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h index 4ec2b930dfbb..0f6c251f5fec 100644 --- a/include/asm-mips/mach-generic/ide.h +++ b/include/asm-mips/mach-generic/ide.h | |||
| @@ -27,8 +27,6 @@ | |||
| 27 | # endif | 27 | # endif |
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | #define IDE_ARCH_OBSOLETE_DEFAULTS | ||
| 31 | |||
| 32 | static __inline__ int ide_probe_legacy(void) | 30 | static __inline__ int ide_probe_legacy(void) |
| 33 | { | 31 | { |
| 34 | #ifdef CONFIG_PCI | 32 | #ifdef CONFIG_PCI |
| @@ -98,14 +96,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 98 | } | 96 | } |
| 99 | } | 97 | } |
| 100 | 98 | ||
| 101 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 102 | |||
| 103 | #ifdef CONFIG_BLK_DEV_IDEPCI | ||
| 104 | #define ide_init_default_irq(base) (0) | ||
| 105 | #else | ||
| 106 | #define ide_init_default_irq(base) ide_default_irq(base) | ||
| 107 | #endif | ||
| 108 | |||
| 109 | /* MIPS port and memory-mapped I/O string operations. */ | 99 | /* MIPS port and memory-mapped I/O string operations. */ |
| 110 | static inline void __ide_flush_prologue(void) | 100 | static inline void __ide_flush_prologue(void) |
| 111 | { | 101 | { |
diff --git a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h index be8760fbc8ee..db0c94410095 100644 --- a/include/asm-parisc/ide.h +++ b/include/asm-parisc/ide.h | |||
| @@ -17,8 +17,6 @@ | |||
| 17 | #define MAX_HWIFS 2 | 17 | #define MAX_HWIFS 2 |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 21 | |||
| 22 | #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) | 20 | #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) |
| 23 | #define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) | 21 | #define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) |
| 24 | #define ide_request_region(from,extent,name) request_region((from), (extent), (name)) | 22 | #define ide_request_region(from,extent,name) request_region((from), (extent), (name)) |
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h index 6d50310ecaea..3d90bf7d3d73 100644 --- a/include/asm-powerpc/ide.h +++ b/include/asm-powerpc/ide.h | |||
| @@ -31,39 +31,48 @@ | |||
| 31 | #include <linux/hdreg.h> | 31 | #include <linux/hdreg.h> |
| 32 | #include <linux/ioport.h> | 32 | #include <linux/ioport.h> |
| 33 | 33 | ||
| 34 | struct ide_machdep_calls { | 34 | /* FIXME: use ide_platform host driver */ |
| 35 | int (*default_irq)(unsigned long base); | ||
| 36 | unsigned long (*default_io_base)(int index); | ||
| 37 | void (*ide_init_hwif)(hw_regs_t *hw, | ||
| 38 | unsigned long data_port, | ||
| 39 | unsigned long ctrl_port, | ||
| 40 | int *irq); | ||
| 41 | }; | ||
| 42 | |||
| 43 | extern struct ide_machdep_calls ppc_ide_md; | ||
| 44 | |||
| 45 | #define IDE_ARCH_OBSOLETE_DEFAULTS | ||
| 46 | |||
| 47 | static __inline__ int ide_default_irq(unsigned long base) | 35 | static __inline__ int ide_default_irq(unsigned long base) |
| 48 | { | 36 | { |
| 49 | if (ppc_ide_md.default_irq) | 37 | #ifdef CONFIG_PPLUS |
| 50 | return ppc_ide_md.default_irq(base); | 38 | switch (base) { |
| 39 | case 0x1f0: return 14; | ||
| 40 | case 0x170: return 15; | ||
| 41 | } | ||
| 42 | #endif | ||
| 43 | #ifdef CONFIG_PPC_PREP | ||
| 44 | switch (base) { | ||
| 45 | case 0x1f0: return 13; | ||
| 46 | case 0x170: return 13; | ||
| 47 | case 0x1e8: return 11; | ||
| 48 | case 0x168: return 10; | ||
| 49 | case 0xfff0: return 14; /* MCP(N)750 ide0 */ | ||
| 50 | case 0xffe0: return 15; /* MCP(N)750 ide1 */ | ||
| 51 | } | ||
| 52 | #endif | ||
| 51 | return 0; | 53 | return 0; |
| 52 | } | 54 | } |
| 53 | 55 | ||
| 56 | /* FIXME: use ide_platform host driver */ | ||
| 54 | static __inline__ unsigned long ide_default_io_base(int index) | 57 | static __inline__ unsigned long ide_default_io_base(int index) |
| 55 | { | 58 | { |
| 56 | if (ppc_ide_md.default_io_base) | 59 | #ifdef CONFIG_PPLUS |
| 57 | return ppc_ide_md.default_io_base(index); | 60 | switch (index) { |
| 61 | case 0: return 0x1f0; | ||
| 62 | case 1: return 0x170; | ||
| 63 | } | ||
| 64 | #endif | ||
| 65 | #ifdef CONFIG_PPC_PREP | ||
| 66 | switch (index) { | ||
| 67 | case 0: return 0x1f0; | ||
| 68 | case 1: return 0x170; | ||
| 69 | case 2: return 0x1e8; | ||
| 70 | case 3: return 0x168; | ||
| 71 | } | ||
| 72 | #endif | ||
| 58 | return 0; | 73 | return 0; |
| 59 | } | 74 | } |
| 60 | 75 | ||
| 61 | #ifdef CONFIG_PCI | ||
| 62 | #define ide_init_default_irq(base) (0) | ||
| 63 | #else | ||
| 64 | #define ide_init_default_irq(base) ide_default_irq(base) | ||
| 65 | #endif | ||
| 66 | |||
| 67 | #ifdef CONFIG_BLK_DEV_MPC8xx_IDE | 76 | #ifdef CONFIG_BLK_DEV_MPC8xx_IDE |
| 68 | #define IDE_ARCH_ACK_INTR 1 | 77 | #define IDE_ARCH_ACK_INTR 1 |
| 69 | #define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) | 78 | #define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) |
| @@ -71,8 +80,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 71 | 80 | ||
| 72 | #endif /* __powerpc64__ */ | 81 | #endif /* __powerpc64__ */ |
| 73 | 82 | ||
| 74 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 75 | |||
| 76 | #endif /* __KERNEL__ */ | 83 | #endif /* __KERNEL__ */ |
| 77 | 84 | ||
| 78 | #endif /* _ASM_POWERPC_IDE_H */ | 85 | #endif /* _ASM_POWERPC_IDE_H */ |
diff --git a/include/asm-powerpc/mediabay.h b/include/asm-powerpc/mediabay.h index de83fe196309..df111c362a7f 100644 --- a/include/asm-powerpc/mediabay.h +++ b/include/asm-powerpc/mediabay.h | |||
| @@ -22,10 +22,14 @@ int check_media_bay(struct device_node *which_bay, int what); | |||
| 22 | /* Number of bays in the machine or 0 */ | 22 | /* Number of bays in the machine or 0 */ |
| 23 | extern int media_bay_count; | 23 | extern int media_bay_count; |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_BLK_DEV_IDE_PMAC | ||
| 26 | #include <linux/ide.h> | ||
| 27 | |||
| 25 | int check_media_bay_by_base(unsigned long base, int what); | 28 | int check_media_bay_by_base(unsigned long base, int what); |
| 26 | /* called by IDE PMAC host driver to register IDE controller for media bay */ | 29 | /* called by IDE PMAC host driver to register IDE controller for media bay */ |
| 27 | int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base, | 30 | int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base, |
| 28 | int irq, int index); | 31 | int irq, ide_hwif_t *hwif); |
| 32 | #endif | ||
| 29 | 33 | ||
| 30 | #endif /* __KERNEL__ */ | 34 | #endif /* __KERNEL__ */ |
| 31 | #endif /* _PPC_MEDIABAY_H */ | 35 | #endif /* _PPC_MEDIABAY_H */ |
diff --git a/include/asm-sh/ide.h b/include/asm-sh/ide.h index 9f8e9142dc33..58e0bdd52be4 100644 --- a/include/asm-sh/ide.h +++ b/include/asm-sh/ide.h | |||
| @@ -14,9 +14,6 @@ | |||
| 14 | 14 | ||
| 15 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
| 16 | 16 | ||
| 17 | |||
| 18 | #define ide_default_io_ctl(base) (0) | ||
| 19 | |||
| 20 | #include <asm-generic/ide_iops.h> | 17 | #include <asm-generic/ide_iops.h> |
| 21 | 18 | ||
| 22 | #endif /* __KERNEL__ */ | 19 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h index 4076cb5d1581..afd1736ed480 100644 --- a/include/asm-sparc/ide.h +++ b/include/asm-sparc/ide.h | |||
| @@ -17,8 +17,6 @@ | |||
| 17 | #undef MAX_HWIFS | 17 | #undef MAX_HWIFS |
| 18 | #define MAX_HWIFS 2 | 18 | #define MAX_HWIFS 2 |
| 19 | 19 | ||
| 20 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 21 | |||
| 22 | #define __ide_insl(data_reg, buffer, wcount) \ | 20 | #define __ide_insl(data_reg, buffer, wcount) \ |
| 23 | __ide_insw(data_reg, buffer, (wcount)<<1) | 21 | __ide_insw(data_reg, buffer, (wcount)<<1) |
| 24 | #define __ide_outsl(data_reg, buffer, wcount) \ | 22 | #define __ide_outsl(data_reg, buffer, wcount) \ |
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h index ac7eb210b941..c5fdabe0b42d 100644 --- a/include/asm-sparc64/ide.h +++ b/include/asm-sparc64/ide.h | |||
| @@ -24,8 +24,6 @@ | |||
| 24 | # endif | 24 | # endif |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 28 | |||
| 29 | #define __ide_insl(data_reg, buffer, wcount) \ | 27 | #define __ide_insl(data_reg, buffer, wcount) \ |
| 30 | __ide_insw(data_reg, buffer, (wcount)<<1) | 28 | __ide_insw(data_reg, buffer, (wcount)<<1) |
| 31 | #define __ide_outsl(data_reg, buffer, wcount) \ | 29 | #define __ide_outsl(data_reg, buffer, wcount) \ |
diff --git a/include/asm-x86/ide.h b/include/asm-x86/ide.h index c2552d8bebf7..cf9c98e5bdb5 100644 --- a/include/asm-x86/ide.h +++ b/include/asm-x86/ide.h | |||
| @@ -20,8 +20,6 @@ | |||
| 20 | # endif | 20 | # endif |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| 23 | #define IDE_ARCH_OBSOLETE_DEFAULTS | ||
| 24 | |||
| 25 | static __inline__ int ide_default_irq(unsigned long base) | 23 | static __inline__ int ide_default_irq(unsigned long base) |
| 26 | { | 24 | { |
| 27 | switch (base) { | 25 | switch (base) { |
| @@ -60,14 +58,6 @@ static __inline__ unsigned long ide_default_io_base(int index) | |||
| 60 | } | 58 | } |
| 61 | } | 59 | } |
| 62 | 60 | ||
| 63 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
| 64 | |||
| 65 | #ifdef CONFIG_BLK_DEV_IDEPCI | ||
| 66 | #define ide_init_default_irq(base) (0) | ||
| 67 | #else | ||
| 68 | #define ide_init_default_irq(base) ide_default_irq(base) | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #include <asm-generic/ide_iops.h> | 61 | #include <asm-generic/ide_iops.h> |
| 72 | 62 | ||
| 73 | #endif /* __KERNEL__ */ | 63 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index e38e75967e74..c37e9241fae7 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h | |||
| @@ -422,9 +422,11 @@ struct hd_geometry { | |||
| 422 | #define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ | 422 | #define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ |
| 423 | #define HDIO_SET_DMA 0x0326 /* change use-dma flag */ | 423 | #define HDIO_SET_DMA 0x0326 /* change use-dma flag */ |
| 424 | #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ | 424 | #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ |
| 425 | #ifndef __KERNEL__ | ||
| 425 | #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ | 426 | #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ |
| 426 | #define HDIO_SET_NICE 0x0329 /* set nice flags */ | ||
| 427 | #define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ | 427 | #define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ |
| 428 | #endif | ||
| 429 | #define HDIO_SET_NICE 0x0329 /* set nice flags */ | ||
| 428 | #define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ | 430 | #define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ |
| 429 | #define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ | 431 | #define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ |
| 430 | #define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ | 432 | #define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ |
diff --git a/include/linux/ide.h b/include/linux/ide.h index bc26b2f27359..6c39482fd1a1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -82,24 +82,10 @@ typedef unsigned char byte; /* used everywhere */ | |||
| 82 | 82 | ||
| 83 | #define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET | 83 | #define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET |
| 84 | #define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET | 84 | #define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET |
| 85 | 85 | #define IDE_ALTSTATUS_OFFSET IDE_CONTROL_OFFSET | |
| 86 | #define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) | 86 | #define IDE_IREASON_OFFSET IDE_NSECTOR_OFFSET |
| 87 | #define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) | 87 | #define IDE_BCOUNTL_OFFSET IDE_LCYL_OFFSET |
| 88 | #define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) | 88 | #define IDE_BCOUNTH_OFFSET IDE_HCYL_OFFSET |
| 89 | #define IDE_SECTOR_REG (HWIF(drive)->io_ports[IDE_SECTOR_OFFSET]) | ||
| 90 | #define IDE_LCYL_REG (HWIF(drive)->io_ports[IDE_LCYL_OFFSET]) | ||
| 91 | #define IDE_HCYL_REG (HWIF(drive)->io_ports[IDE_HCYL_OFFSET]) | ||
| 92 | #define IDE_SELECT_REG (HWIF(drive)->io_ports[IDE_SELECT_OFFSET]) | ||
| 93 | #define IDE_STATUS_REG (HWIF(drive)->io_ports[IDE_STATUS_OFFSET]) | ||
| 94 | #define IDE_CONTROL_REG (HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]) | ||
| 95 | #define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET]) | ||
| 96 | |||
| 97 | #define IDE_FEATURE_REG IDE_ERROR_REG | ||
| 98 | #define IDE_COMMAND_REG IDE_STATUS_REG | ||
| 99 | #define IDE_ALTSTATUS_REG IDE_CONTROL_REG | ||
| 100 | #define IDE_IREASON_REG IDE_NSECTOR_REG | ||
| 101 | #define IDE_BCOUNTL_REG IDE_LCYL_REG | ||
| 102 | #define IDE_BCOUNTH_REG IDE_HCYL_REG | ||
| 103 | 89 | ||
| 104 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) | 90 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) |
| 105 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) | 91 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) |
| @@ -169,7 +155,7 @@ enum { ide_unknown, ide_generic, ide_pci, | |||
| 169 | ide_rz1000, ide_trm290, | 155 | ide_rz1000, ide_trm290, |
| 170 | ide_cmd646, ide_cy82c693, ide_4drives, | 156 | ide_cmd646, ide_cy82c693, ide_4drives, |
| 171 | ide_pmac, ide_etrax100, ide_acorn, | 157 | ide_pmac, ide_etrax100, ide_acorn, |
| 172 | ide_au1xxx, ide_palm3710, ide_forced | 158 | ide_au1xxx, ide_palm3710 |
| 173 | }; | 159 | }; |
| 174 | 160 | ||
| 175 | typedef u8 hwif_chipset_t; | 161 | typedef u8 hwif_chipset_t; |
| @@ -186,14 +172,9 @@ typedef struct hw_regs_s { | |||
| 186 | } hw_regs_t; | 172 | } hw_regs_t; |
| 187 | 173 | ||
| 188 | struct hwif_s * ide_find_port(unsigned long); | 174 | struct hwif_s * ide_find_port(unsigned long); |
| 189 | struct hwif_s *ide_deprecated_find_port(unsigned long); | ||
| 190 | void ide_init_port_data(struct hwif_s *, unsigned int); | 175 | void ide_init_port_data(struct hwif_s *, unsigned int); |
| 191 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); | 176 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); |
| 192 | 177 | ||
| 193 | struct ide_drive_s; | ||
| 194 | int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *), | ||
| 195 | struct hwif_s **); | ||
| 196 | |||
| 197 | static inline void ide_std_init_ports(hw_regs_t *hw, | 178 | static inline void ide_std_init_ports(hw_regs_t *hw, |
| 198 | unsigned long io_addr, | 179 | unsigned long io_addr, |
| 199 | unsigned long ctl_addr) | 180 | unsigned long ctl_addr) |
| @@ -213,45 +194,6 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
| 213 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | 194 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS |
| 214 | #endif | 195 | #endif |
| 215 | 196 | ||
| 216 | /* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ | ||
| 217 | #ifndef IDE_ARCH_OBSOLETE_DEFAULTS | ||
| 218 | # define ide_default_io_base(index) (0) | ||
| 219 | # define ide_default_irq(base) (0) | ||
| 220 | # define ide_init_default_irq(base) (0) | ||
| 221 | #endif | ||
| 222 | |||
| 223 | #ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT | ||
| 224 | static inline void ide_init_hwif_ports(hw_regs_t *hw, | ||
| 225 | unsigned long io_addr, | ||
| 226 | unsigned long ctl_addr, | ||
| 227 | int *irq) | ||
| 228 | { | ||
| 229 | if (!ctl_addr) | ||
| 230 | ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr)); | ||
| 231 | else | ||
| 232 | ide_std_init_ports(hw, io_addr, ctl_addr); | ||
| 233 | |||
| 234 | if (irq) | ||
| 235 | *irq = 0; | ||
| 236 | |||
| 237 | hw->io_ports[IDE_IRQ_OFFSET] = 0; | ||
| 238 | |||
| 239 | #ifdef CONFIG_PPC32 | ||
| 240 | if (ppc_ide_md.ide_init_hwif) | ||
| 241 | ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq); | ||
| 242 | #endif | ||
| 243 | } | ||
| 244 | #else | ||
| 245 | static inline void ide_init_hwif_ports(hw_regs_t *hw, | ||
| 246 | unsigned long io_addr, | ||
| 247 | unsigned long ctl_addr, | ||
| 248 | int *irq) | ||
| 249 | { | ||
| 250 | if (io_addr || ctl_addr) | ||
| 251 | printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); | ||
| 252 | } | ||
| 253 | #endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */ | ||
| 254 | |||
| 255 | /* Currently only m68k, apus and m8xx need it */ | 197 | /* Currently only m68k, apus and m8xx need it */ |
| 256 | #ifndef IDE_ARCH_ACK_INTR | 198 | #ifndef IDE_ARCH_ACK_INTR |
| 257 | # define ide_ack_intr(hwif) (1) | 199 | # define ide_ack_intr(hwif) (1) |
| @@ -406,7 +348,7 @@ typedef struct ide_drive_s { | |||
| 406 | u8 wcache; /* status of write cache */ | 348 | u8 wcache; /* status of write cache */ |
| 407 | u8 acoustic; /* acoustic management */ | 349 | u8 acoustic; /* acoustic management */ |
| 408 | u8 media; /* disk, cdrom, tape, floppy, ... */ | 350 | u8 media; /* disk, cdrom, tape, floppy, ... */ |
| 409 | u8 ctl; /* "normal" value for IDE_CONTROL_REG */ | 351 | u8 ctl; /* "normal" value for Control register */ |
| 410 | u8 ready_stat; /* min status value for drive ready */ | 352 | u8 ready_stat; /* min status value for drive ready */ |
| 411 | u8 mult_count; /* current multiple sector setting */ | 353 | u8 mult_count; /* current multiple sector setting */ |
| 412 | u8 mult_req; /* requested multiple sector setting */ | 354 | u8 mult_req; /* requested multiple sector setting */ |
| @@ -507,8 +449,6 @@ typedef struct hwif_s { | |||
| 507 | void (*maskproc)(ide_drive_t *, int); | 449 | void (*maskproc)(ide_drive_t *, int); |
| 508 | /* check host's drive quirk list */ | 450 | /* check host's drive quirk list */ |
| 509 | void (*quirkproc)(ide_drive_t *); | 451 | void (*quirkproc)(ide_drive_t *); |
| 510 | /* driver soft-power interface */ | ||
| 511 | int (*busproc)(ide_drive_t *, int); | ||
| 512 | #endif | 452 | #endif |
| 513 | u8 (*mdma_filter)(ide_drive_t *); | 453 | u8 (*mdma_filter)(ide_drive_t *); |
| 514 | u8 (*udma_filter)(ide_drive_t *); | 454 | u8 (*udma_filter)(ide_drive_t *); |
| @@ -578,7 +518,6 @@ typedef struct hwif_s { | |||
| 578 | 518 | ||
| 579 | unsigned noprobe : 1; /* don't probe for this interface */ | 519 | unsigned noprobe : 1; /* don't probe for this interface */ |
| 580 | unsigned present : 1; /* this interface exists */ | 520 | unsigned present : 1; /* this interface exists */ |
| 581 | unsigned hold : 1; /* this interface is always present */ | ||
| 582 | unsigned serialized : 1; /* serialized all channel operation */ | 521 | unsigned serialized : 1; /* serialized all channel operation */ |
| 583 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 522 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
| 584 | unsigned reset : 1; /* reset after probe */ | 523 | unsigned reset : 1; /* reset after probe */ |
| @@ -586,7 +525,9 @@ typedef struct hwif_s { | |||
| 586 | unsigned mmio : 1; /* host uses MMIO */ | 525 | unsigned mmio : 1; /* host uses MMIO */ |
| 587 | unsigned straight8 : 1; /* Alan's straight 8 check */ | 526 | unsigned straight8 : 1; /* Alan's straight 8 check */ |
| 588 | 527 | ||
| 589 | struct device gendev; | 528 | struct device gendev; |
| 529 | struct device *portdev; | ||
| 530 | |||
| 590 | struct completion gendev_rel_comp; /* To deal with device release() */ | 531 | struct completion gendev_rel_comp; /* To deal with device release() */ |
| 591 | 532 | ||
| 592 | void *hwif_data; /* extra hwif data */ | 533 | void *hwif_data; /* extra hwif data */ |
| @@ -647,6 +588,68 @@ int set_io_32bit(ide_drive_t *, int); | |||
| 647 | int set_pio_mode(ide_drive_t *, int); | 588 | int set_pio_mode(ide_drive_t *, int); |
| 648 | int set_using_dma(ide_drive_t *, int); | 589 | int set_using_dma(ide_drive_t *, int); |
| 649 | 590 | ||
| 591 | /* ATAPI packet command flags */ | ||
| 592 | enum { | ||
| 593 | /* set when an error is considered normal - no retry (ide-tape) */ | ||
| 594 | PC_FLAG_ABORT = (1 << 0), | ||
| 595 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | ||
| 596 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | ||
| 597 | PC_FLAG_DMA_OK = (1 << 3), | ||
| 598 | PC_FLAG_DMA_RECOMMENDED = (1 << 4), | ||
| 599 | PC_FLAG_DMA_IN_PROGRESS = (1 << 5), | ||
| 600 | PC_FLAG_DMA_ERROR = (1 << 6), | ||
| 601 | PC_FLAG_WRITING = (1 << 7), | ||
| 602 | /* command timed out */ | ||
| 603 | PC_FLAG_TIMEDOUT = (1 << 8), | ||
| 604 | }; | ||
| 605 | |||
| 606 | struct ide_atapi_pc { | ||
| 607 | /* actual packet bytes */ | ||
| 608 | u8 c[12]; | ||
| 609 | /* incremented on each retry */ | ||
| 610 | int retries; | ||
| 611 | int error; | ||
| 612 | |||
| 613 | /* bytes to transfer */ | ||
| 614 | int req_xfer; | ||
| 615 | /* bytes actually transferred */ | ||
| 616 | int xferred; | ||
| 617 | |||
| 618 | /* data buffer */ | ||
| 619 | u8 *buf; | ||
| 620 | /* current buffer position */ | ||
| 621 | u8 *cur_pos; | ||
| 622 | int buf_size; | ||
| 623 | /* missing/available data on the current buffer */ | ||
| 624 | int b_count; | ||
| 625 | |||
| 626 | /* the corresponding request */ | ||
| 627 | struct request *rq; | ||
| 628 | |||
| 629 | unsigned long flags; | ||
| 630 | |||
| 631 | /* | ||
| 632 | * those are more or less driver-specific and some of them are subject | ||
| 633 | * to change/removal later. | ||
| 634 | */ | ||
| 635 | u8 pc_buf[256]; | ||
| 636 | void (*idefloppy_callback) (ide_drive_t *); | ||
| 637 | ide_startstop_t (*idetape_callback) (ide_drive_t *); | ||
| 638 | |||
| 639 | /* idetape only */ | ||
| 640 | struct idetape_bh *bh; | ||
| 641 | char *b_data; | ||
| 642 | |||
| 643 | /* idescsi only for now */ | ||
| 644 | struct scatterlist *sg; | ||
| 645 | unsigned int sg_cnt; | ||
| 646 | |||
| 647 | struct scsi_cmnd *scsi_cmd; | ||
| 648 | void (*done) (struct scsi_cmnd *); | ||
| 649 | |||
| 650 | unsigned long timeout; | ||
| 651 | }; | ||
| 652 | |||
| 650 | #ifdef CONFIG_IDE_PROC_FS | 653 | #ifdef CONFIG_IDE_PROC_FS |
| 651 | /* | 654 | /* |
| 652 | * configurable drive settings | 655 | * configurable drive settings |
| @@ -691,6 +694,7 @@ void proc_ide_create(void); | |||
| 691 | void proc_ide_destroy(void); | 694 | void proc_ide_destroy(void); |
| 692 | void ide_proc_register_port(ide_hwif_t *); | 695 | void ide_proc_register_port(ide_hwif_t *); |
| 693 | void ide_proc_port_register_devices(ide_hwif_t *); | 696 | void ide_proc_port_register_devices(ide_hwif_t *); |
| 697 | void ide_proc_unregister_device(ide_drive_t *); | ||
| 694 | void ide_proc_unregister_port(ide_hwif_t *); | 698 | void ide_proc_unregister_port(ide_hwif_t *); |
| 695 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); | 699 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); |
| 696 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); | 700 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); |
| @@ -724,6 +728,7 @@ static inline void proc_ide_create(void) { ; } | |||
| 724 | static inline void proc_ide_destroy(void) { ; } | 728 | static inline void proc_ide_destroy(void) { ; } |
| 725 | static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } | 729 | static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } |
| 726 | static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } | 730 | static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } |
| 731 | static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; } | ||
| 727 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } | 732 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } |
| 728 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 733 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
| 729 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 734 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
| @@ -990,7 +995,6 @@ extern void do_ide_request(struct request_queue *); | |||
| 990 | void ide_init_disk(struct gendisk *, ide_drive_t *); | 995 | void ide_init_disk(struct gendisk *, ide_drive_t *); |
| 991 | 996 | ||
| 992 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | 997 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER |
| 993 | extern int ide_scan_direction; | ||
| 994 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); | 998 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); |
| 995 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) | 999 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) |
| 996 | #else | 1000 | #else |
| @@ -1195,7 +1199,7 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | |||
| 1195 | void ide_remove_port_from_hwgroup(ide_hwif_t *); | 1199 | void ide_remove_port_from_hwgroup(ide_hwif_t *); |
| 1196 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); | 1200 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); |
| 1197 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); | 1201 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); |
| 1198 | void ide_unregister(unsigned int, int, int); | 1202 | void ide_unregister(unsigned int); |
| 1199 | 1203 | ||
| 1200 | void ide_register_region(struct gendisk *); | 1204 | void ide_register_region(struct gendisk *); |
| 1201 | void ide_unregister_region(struct gendisk *); | 1205 | void ide_unregister_region(struct gendisk *); |
| @@ -1204,6 +1208,8 @@ void ide_undecoded_slave(ide_drive_t *); | |||
| 1204 | 1208 | ||
| 1205 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); | 1209 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); |
| 1206 | int ide_device_add(u8 idx[4], const struct ide_port_info *); | 1210 | int ide_device_add(u8 idx[4], const struct ide_port_info *); |
| 1211 | void ide_port_unregister_devices(ide_hwif_t *); | ||
| 1212 | void ide_port_scan(ide_hwif_t *); | ||
| 1207 | 1213 | ||
| 1208 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) | 1214 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) |
| 1209 | { | 1215 | { |
| @@ -1279,6 +1285,7 @@ extern struct mutex ide_cfg_mtx; | |||
| 1279 | #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) | 1285 | #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) |
| 1280 | 1286 | ||
| 1281 | extern struct bus_type ide_bus_type; | 1287 | extern struct bus_type ide_bus_type; |
| 1288 | extern struct class *ide_port_class; | ||
| 1282 | 1289 | ||
| 1283 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ | 1290 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ |
| 1284 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) | 1291 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) |
| @@ -1307,7 +1314,10 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) | |||
| 1307 | 1314 | ||
| 1308 | static inline void ide_set_irq(ide_drive_t *drive, int on) | 1315 | static inline void ide_set_irq(ide_drive_t *drive, int on) |
| 1309 | { | 1316 | { |
| 1310 | drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); | 1317 | ide_hwif_t *hwif = drive->hwif; |
| 1318 | |||
| 1319 | hwif->OUTB(drive->ctl | (on ? 0 : 2), | ||
| 1320 | hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
| 1311 | } | 1321 | } |
| 1312 | 1322 | ||
| 1313 | static inline u8 ide_read_status(ide_drive_t *drive) | 1323 | static inline u8 ide_read_status(ide_drive_t *drive) |
| @@ -1331,4 +1341,26 @@ static inline u8 ide_read_error(ide_drive_t *drive) | |||
| 1331 | return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); | 1341 | return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); |
| 1332 | } | 1342 | } |
| 1333 | 1343 | ||
| 1344 | /* | ||
| 1345 | * Too bad. The drive wants to send us data which we are not ready to accept. | ||
| 1346 | * Just throw it away. | ||
| 1347 | */ | ||
| 1348 | static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount) | ||
| 1349 | { | ||
| 1350 | ide_hwif_t *hwif = drive->hwif; | ||
| 1351 | |||
| 1352 | /* FIXME: use ->atapi_input_bytes */ | ||
| 1353 | while (bcount--) | ||
| 1354 | (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]); | ||
| 1355 | } | ||
| 1356 | |||
| 1357 | static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) | ||
| 1358 | { | ||
| 1359 | ide_hwif_t *hwif = drive->hwif; | ||
| 1360 | |||
| 1361 | /* FIXME: use ->atapi_output_bytes */ | ||
| 1362 | while (bcount--) | ||
| 1363 | hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]); | ||
| 1364 | } | ||
| 1365 | |||
| 1334 | #endif /* _IDE_H */ | 1366 | #endif /* _IDE_H */ |
