Commit 7c7e92a9268965e08bba853ecdb94fa55e886741
Committed by
Bartlomiej Zolnierkiewicz
1 parent
b2a53bc636
Exists in
master
and in
7 other branches
Palmchip BK3710 IDE driver
This is Palmchip BK3710 IDE controller support. The IDE controller logic supports PIO, MultiWord-DMA and Ultra-DMA modes. Supports interface to Compact Flash (CF) configured in True-IDE mode. Bart: - remove dead code - fix ide_hwif_setup_dma() build problem Signed-off-by: Anton Salnikov <asalnikov@ru.mvista.com> Reviewed-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Showing 5 changed files with 409 additions and 2 deletions Inline Diff
drivers/ide/Kconfig
1 | # | 1 | # |
2 | # IDE ATA ATAPI Block device driver configuration | 2 | # IDE ATA ATAPI Block device driver configuration |
3 | # | 3 | # |
4 | # Andre Hedrick <andre@linux-ide.org> | 4 | # Andre Hedrick <andre@linux-ide.org> |
5 | # | 5 | # |
6 | 6 | ||
7 | menuconfig IDE | 7 | menuconfig IDE |
8 | tristate "ATA/ATAPI/MFM/RLL support" | 8 | tristate "ATA/ATAPI/MFM/RLL support" |
9 | depends on BLOCK | 9 | depends on BLOCK |
10 | depends on HAS_IOMEM | 10 | depends on HAS_IOMEM |
11 | ---help--- | 11 | ---help--- |
12 | If you say Y here, your kernel will be able to manage low cost mass | 12 | If you say Y here, your kernel will be able to manage low cost mass |
13 | storage units such as ATA/(E)IDE and ATAPI units. The most common | 13 | storage units such as ATA/(E)IDE and ATAPI units. The most common |
14 | cases are IDE hard drives and ATAPI CD-ROM drives. | 14 | cases are IDE hard drives and ATAPI CD-ROM drives. |
15 | 15 | ||
16 | If your system is pure SCSI and doesn't use these interfaces, you | 16 | If your system is pure SCSI and doesn't use these interfaces, you |
17 | can say N here. | 17 | can say N here. |
18 | 18 | ||
19 | Integrated Disk Electronics (IDE aka ATA-1) is a connecting standard | 19 | Integrated Disk Electronics (IDE aka ATA-1) is a connecting standard |
20 | for mass storage units such as hard disks. It was designed by | 20 | for mass storage units such as hard disks. It was designed by |
21 | Western Digital and Compaq Computer in 1984. It was then named | 21 | Western Digital and Compaq Computer in 1984. It was then named |
22 | ST506. Quite a number of disks use the IDE interface. | 22 | ST506. Quite a number of disks use the IDE interface. |
23 | 23 | ||
24 | AT Attachment (ATA) is the superset of the IDE specifications. | 24 | AT Attachment (ATA) is the superset of the IDE specifications. |
25 | ST506 was also called ATA-1. | 25 | ST506 was also called ATA-1. |
26 | 26 | ||
27 | Fast-IDE is ATA-2 (also named Fast ATA), Enhanced IDE (EIDE) is | 27 | Fast-IDE is ATA-2 (also named Fast ATA), Enhanced IDE (EIDE) is |
28 | ATA-3. It provides support for larger disks (up to 8.4GB by means of | 28 | ATA-3. It provides support for larger disks (up to 8.4GB by means of |
29 | the LBA standard), more disks (4 instead of 2) and for other mass | 29 | the LBA standard), more disks (4 instead of 2) and for other mass |
30 | storage units such as tapes and cdrom. UDMA/33 (aka UltraDMA/33) is | 30 | storage units such as tapes and cdrom. UDMA/33 (aka UltraDMA/33) is |
31 | ATA-4 and provides faster (and more CPU friendly) transfer modes | 31 | ATA-4 and provides faster (and more CPU friendly) transfer modes |
32 | than previous PIO (Programmed processor Input/Output) from previous | 32 | than previous PIO (Programmed processor Input/Output) from previous |
33 | ATA/IDE standards by means of fast DMA controllers. | 33 | ATA/IDE standards by means of fast DMA controllers. |
34 | 34 | ||
35 | ATA Packet Interface (ATAPI) is a protocol used by EIDE tape and | 35 | ATA Packet Interface (ATAPI) is a protocol used by EIDE tape and |
36 | CD-ROM drives, similar in many respects to the SCSI protocol. | 36 | CD-ROM drives, similar in many respects to the SCSI protocol. |
37 | 37 | ||
38 | SMART IDE (Self Monitoring, Analysis and Reporting Technology) was | 38 | SMART IDE (Self Monitoring, Analysis and Reporting Technology) was |
39 | designed in order to prevent data corruption and disk crash by | 39 | designed in order to prevent data corruption and disk crash by |
40 | detecting pre hardware failure conditions (heat, access time, and | 40 | detecting pre hardware failure conditions (heat, access time, and |
41 | the like...). Disks built since June 1995 may follow this standard. | 41 | the like...). Disks built since June 1995 may follow this standard. |
42 | The kernel itself doesn't manage this; however there are quite a | 42 | The kernel itself doesn't manage this; however there are quite a |
43 | number of user programs such as smart that can query the status of | 43 | number of user programs such as smart that can query the status of |
44 | SMART parameters from disk drives. | 44 | SMART parameters from disk drives. |
45 | 45 | ||
46 | To compile this driver as a module, choose M here: the | 46 | To compile this driver as a module, choose M here: the |
47 | module will be called ide. | 47 | module will be called ide. |
48 | 48 | ||
49 | For further information, please read <file:Documentation/ide.txt>. | 49 | For further information, please read <file:Documentation/ide.txt>. |
50 | 50 | ||
51 | If unsure, say Y. | 51 | If unsure, say Y. |
52 | 52 | ||
53 | if IDE | 53 | if IDE |
54 | 54 | ||
55 | config IDE_MAX_HWIFS | 55 | config IDE_MAX_HWIFS |
56 | int "Max IDE interfaces" | 56 | int "Max IDE interfaces" |
57 | depends on ALPHA || SUPERH || IA64 || EMBEDDED | 57 | depends on ALPHA || SUPERH || IA64 || EMBEDDED |
58 | range 1 10 | 58 | range 1 10 |
59 | default 4 | 59 | default 4 |
60 | help | 60 | help |
61 | This is the maximum number of IDE hardware interfaces that will | 61 | This is the maximum number of IDE hardware interfaces that will |
62 | be supported by the driver. Make sure it is at least as high as | 62 | be supported by the driver. Make sure it is at least as high as |
63 | the number of IDE interfaces in your system. | 63 | the number of IDE interfaces in your system. |
64 | 64 | ||
65 | config BLK_DEV_IDE | 65 | config BLK_DEV_IDE |
66 | tristate "Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support" | 66 | tristate "Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support" |
67 | ---help--- | 67 | ---help--- |
68 | If you say Y here, you will use the full-featured IDE driver to | 68 | If you say Y here, you will use the full-featured IDE driver to |
69 | control up to ten ATA/IDE interfaces, each being able to serve a | 69 | control up to ten ATA/IDE interfaces, each being able to serve a |
70 | "master" and a "slave" device, for a total of up to twenty ATA/IDE | 70 | "master" and a "slave" device, for a total of up to twenty ATA/IDE |
71 | disk/cdrom/tape/floppy drives. | 71 | disk/cdrom/tape/floppy drives. |
72 | 72 | ||
73 | Useful information about large (>540 MB) IDE disks, multiple | 73 | Useful information about large (>540 MB) IDE disks, multiple |
74 | interfaces, what to do if ATA/IDE devices are not automatically | 74 | interfaces, what to do if ATA/IDE devices are not automatically |
75 | detected, sound card ATA/IDE ports, module support, and other | 75 | detected, sound card ATA/IDE ports, module support, and other |
76 | topics, is contained in <file:Documentation/ide.txt>. For detailed | 76 | topics, is contained in <file:Documentation/ide.txt>. For detailed |
77 | information about hard drives, consult the Disk-HOWTO and the | 77 | information about hard drives, consult the Disk-HOWTO and the |
78 | Multi-Disk-HOWTO, available from | 78 | Multi-Disk-HOWTO, available from |
79 | <http://www.tldp.org/docs.html#howto>. | 79 | <http://www.tldp.org/docs.html#howto>. |
80 | 80 | ||
81 | To fine-tune ATA/IDE drive/interface parameters for improved | 81 | To fine-tune ATA/IDE drive/interface parameters for improved |
82 | performance, look for the hdparm package at | 82 | performance, look for the hdparm package at |
83 | <ftp://ibiblio.org/pub/Linux/system/hardware/>. | 83 | <ftp://ibiblio.org/pub/Linux/system/hardware/>. |
84 | 84 | ||
85 | To compile this driver as a module, choose M here and read | 85 | To compile this driver as a module, choose M here and read |
86 | <file:Documentation/ide.txt>. The module will be called ide-mod. | 86 | <file:Documentation/ide.txt>. The module will be called ide-mod. |
87 | Do not compile this driver as a module if your root file system (the | 87 | Do not compile this driver as a module if your root file system (the |
88 | one containing the directory /) is located on an IDE device. | 88 | one containing the directory /) is located on an IDE device. |
89 | 89 | ||
90 | If you have one or more IDE drives, say Y or M here. If your system | 90 | If you have one or more IDE drives, say Y or M here. If your system |
91 | has no IDE drives, or if memory requirements are really tight, you | 91 | has no IDE drives, or if memory requirements are really tight, you |
92 | could say N here, and select the "Old hard disk driver" below | 92 | could say N here, and select the "Old hard disk driver" below |
93 | instead to save about 13 KB of memory in the kernel. | 93 | instead to save about 13 KB of memory in the kernel. |
94 | 94 | ||
95 | if BLK_DEV_IDE | 95 | if BLK_DEV_IDE |
96 | 96 | ||
97 | comment "Please see Documentation/ide.txt for help/info on IDE drives" | 97 | comment "Please see Documentation/ide.txt for help/info on IDE drives" |
98 | 98 | ||
99 | config BLK_DEV_IDE_SATA | 99 | config BLK_DEV_IDE_SATA |
100 | bool "Support for SATA (deprecated; conflicts with libata SATA driver)" | 100 | bool "Support for SATA (deprecated; conflicts with libata SATA driver)" |
101 | default n | 101 | default n |
102 | ---help--- | 102 | ---help--- |
103 | There are two drivers for Serial ATA controllers. | 103 | There are two drivers for Serial ATA controllers. |
104 | 104 | ||
105 | The main driver, "libata", uses the SCSI subsystem | 105 | The main driver, "libata", uses the SCSI subsystem |
106 | and supports most modern SATA controllers. In order to use it | 106 | and supports most modern SATA controllers. In order to use it |
107 | you may take a look at "Serial ATA (prod) and Parallel ATA | 107 | you may take a look at "Serial ATA (prod) and Parallel ATA |
108 | (experimental) drivers". | 108 | (experimental) drivers". |
109 | 109 | ||
110 | The IDE driver (which you are currently configuring) supports | 110 | The IDE driver (which you are currently configuring) supports |
111 | a few first-generation SATA controllers. | 111 | a few first-generation SATA controllers. |
112 | 112 | ||
113 | In order to eliminate conflicts between the two subsystems, | 113 | In order to eliminate conflicts between the two subsystems, |
114 | this config option enables the IDE driver's SATA support. | 114 | this config option enables the IDE driver's SATA support. |
115 | Normally this is disabled, as it is preferred that libata | 115 | Normally this is disabled, as it is preferred that libata |
116 | supports SATA controllers, and this (IDE) driver supports | 116 | supports SATA controllers, and this (IDE) driver supports |
117 | PATA controllers. | 117 | PATA controllers. |
118 | 118 | ||
119 | If unsure, say N. | 119 | If unsure, say N. |
120 | 120 | ||
121 | config BLK_DEV_HD_IDE | 121 | config BLK_DEV_HD_IDE |
122 | bool "Use old disk-only driver on primary interface" | 122 | bool "Use old disk-only driver on primary interface" |
123 | depends on (X86 || SH_MPC1211) | 123 | depends on (X86 || SH_MPC1211) |
124 | ---help--- | 124 | ---help--- |
125 | There are two drivers for MFM/RLL/IDE disks. Most people use just | 125 | There are two drivers for MFM/RLL/IDE disks. Most people use just |
126 | the new enhanced driver by itself. This option however installs the | 126 | the new enhanced driver by itself. This option however installs the |
127 | old hard disk driver to control the primary IDE/disk interface in | 127 | old hard disk driver to control the primary IDE/disk interface in |
128 | the system, leaving the new enhanced IDE driver to take care of only | 128 | the system, leaving the new enhanced IDE driver to take care of only |
129 | the 2nd/3rd/4th IDE interfaces. Doing this will prevent you from | 129 | the 2nd/3rd/4th IDE interfaces. Doing this will prevent you from |
130 | having an IDE/ATAPI CD-ROM or tape drive connected to the primary | 130 | having an IDE/ATAPI CD-ROM or tape drive connected to the primary |
131 | IDE interface. Choosing this option may be useful for older systems | 131 | IDE interface. Choosing this option may be useful for older systems |
132 | which have MFM/RLL/ESDI controller+drives at the primary port | 132 | which have MFM/RLL/ESDI controller+drives at the primary port |
133 | address (0x1f0), along with IDE drives at the secondary/3rd/4th port | 133 | address (0x1f0), along with IDE drives at the secondary/3rd/4th port |
134 | addresses. | 134 | addresses. |
135 | 135 | ||
136 | Normally, just say N here; you will then use the new driver for all | 136 | Normally, just say N here; you will then use the new driver for all |
137 | 4 interfaces. | 137 | 4 interfaces. |
138 | 138 | ||
139 | config BLK_DEV_IDEDISK | 139 | config BLK_DEV_IDEDISK |
140 | tristate "Include IDE/ATA-2 DISK support" | 140 | tristate "Include IDE/ATA-2 DISK support" |
141 | ---help--- | 141 | ---help--- |
142 | This will include enhanced support for MFM/RLL/IDE hard disks. If | 142 | This will include enhanced support for MFM/RLL/IDE hard disks. If |
143 | you have a MFM/RLL/IDE disk, and there is no special reason to use | 143 | you have a MFM/RLL/IDE disk, and there is no special reason to use |
144 | the old hard disk driver instead, say Y. If you have an SCSI-only | 144 | the old hard disk driver instead, say Y. If you have an SCSI-only |
145 | system, you can say N here. | 145 | system, you can say N here. |
146 | 146 | ||
147 | To compile this driver as a module, choose M here: the | 147 | To compile this driver as a module, choose M here: the |
148 | module will be called ide-disk. | 148 | module will be called ide-disk. |
149 | Do not compile this driver as a module if your root file system | 149 | Do not compile this driver as a module if your root file system |
150 | (the one containing the directory /) is located on the IDE disk. | 150 | (the one containing the directory /) is located on the IDE disk. |
151 | 151 | ||
152 | If unsure, say Y. | 152 | If unsure, say Y. |
153 | 153 | ||
154 | config IDEDISK_MULTI_MODE | 154 | config IDEDISK_MULTI_MODE |
155 | bool "Use multiple sector mode for Programmed Input/Output by default" | 155 | bool "Use multiple sector mode for Programmed Input/Output by default" |
156 | help | 156 | help |
157 | This setting is irrelevant for most IDE disks, with direct memory | 157 | This setting is irrelevant for most IDE disks, with direct memory |
158 | access, to which multiple sector mode does not apply. Multiple sector | 158 | access, to which multiple sector mode does not apply. Multiple sector |
159 | mode is a feature of most modern IDE hard drives, permitting the | 159 | mode is a feature of most modern IDE hard drives, permitting the |
160 | transfer of multiple sectors per Programmed Input/Output interrupt, | 160 | transfer of multiple sectors per Programmed Input/Output interrupt, |
161 | rather than the usual one sector per interrupt. When this feature is | 161 | rather than the usual one sector per interrupt. When this feature is |
162 | enabled, it can reduce operating system overhead for disk Programmed | 162 | enabled, it can reduce operating system overhead for disk Programmed |
163 | Input/Output. On some systems, it also can increase the data | 163 | Input/Output. On some systems, it also can increase the data |
164 | throughput of Programmed Input/Output. Some drives, however, seemed | 164 | throughput of Programmed Input/Output. Some drives, however, seemed |
165 | to run slower with multiple sector mode enabled. Some drives claimed | 165 | to run slower with multiple sector mode enabled. Some drives claimed |
166 | to support multiple sector mode, but lost data at some settings. | 166 | to support multiple sector mode, but lost data at some settings. |
167 | Under rare circumstances, such failures could result in massive | 167 | Under rare circumstances, such failures could result in massive |
168 | filesystem corruption. | 168 | filesystem corruption. |
169 | 169 | ||
170 | If you get the following error, try to say Y here: | 170 | If you get the following error, try to say Y here: |
171 | 171 | ||
172 | hda: set_multmode: status=0x51 { DriveReady SeekComplete Error } | 172 | hda: set_multmode: status=0x51 { DriveReady SeekComplete Error } |
173 | hda: set_multmode: error=0x04 { DriveStatusError } | 173 | hda: set_multmode: error=0x04 { DriveStatusError } |
174 | 174 | ||
175 | If in doubt, say N. | 175 | If in doubt, say N. |
176 | 176 | ||
177 | config BLK_DEV_IDECS | 177 | config BLK_DEV_IDECS |
178 | tristate "PCMCIA IDE support" | 178 | tristate "PCMCIA IDE support" |
179 | depends on PCMCIA | 179 | depends on PCMCIA |
180 | help | 180 | help |
181 | Support for Compact Flash cards, outboard IDE disks, tape drives, | 181 | Support for Compact Flash cards, outboard IDE disks, tape drives, |
182 | and CD-ROM drives connected through a PCMCIA card. | 182 | and CD-ROM drives connected through a PCMCIA card. |
183 | 183 | ||
184 | config BLK_DEV_DELKIN | 184 | config BLK_DEV_DELKIN |
185 | tristate "Cardbus IDE support (Delkin/ASKA/Workbit)" | 185 | tristate "Cardbus IDE support (Delkin/ASKA/Workbit)" |
186 | depends on CARDBUS && PCI | 186 | depends on CARDBUS && PCI |
187 | help | 187 | help |
188 | Support for Delkin, ASKA, and Workbit Cardbus CompactFlash | 188 | Support for Delkin, ASKA, and Workbit Cardbus CompactFlash |
189 | Adapters. This may also work for similar SD and XD adapters. | 189 | Adapters. This may also work for similar SD and XD adapters. |
190 | 190 | ||
191 | config BLK_DEV_IDECD | 191 | config BLK_DEV_IDECD |
192 | tristate "Include IDE/ATAPI CDROM support" | 192 | tristate "Include IDE/ATAPI CDROM support" |
193 | ---help--- | 193 | ---help--- |
194 | If you have a CD-ROM drive using the ATAPI protocol, say Y. ATAPI is | 194 | If you have a CD-ROM drive using the ATAPI protocol, say Y. ATAPI is |
195 | a newer protocol used by IDE CD-ROM and TAPE drives, similar to the | 195 | a newer protocol used by IDE CD-ROM and TAPE drives, similar to the |
196 | SCSI protocol. Most new CD-ROM drives use ATAPI, including the | 196 | SCSI protocol. Most new CD-ROM drives use ATAPI, including the |
197 | NEC-260, Mitsumi FX400, Sony 55E, and just about all non-SCSI | 197 | NEC-260, Mitsumi FX400, Sony 55E, and just about all non-SCSI |
198 | double(2X) or better speed drives. | 198 | double(2X) or better speed drives. |
199 | 199 | ||
200 | If you say Y here, the CD-ROM drive will be identified at boot time | 200 | If you say Y here, the CD-ROM drive will be identified at boot time |
201 | along with other IDE devices, as "hdb" or "hdc", or something | 201 | along with other IDE devices, as "hdb" or "hdc", or something |
202 | similar (check the boot messages with dmesg). If this is your only | 202 | similar (check the boot messages with dmesg). If this is your only |
203 | CD-ROM drive, you can say N to all other CD-ROM options, but be sure | 203 | CD-ROM drive, you can say N to all other CD-ROM options, but be sure |
204 | to say Y or M to "ISO 9660 CD-ROM file system support". | 204 | to say Y or M to "ISO 9660 CD-ROM file system support". |
205 | 205 | ||
206 | To compile this driver as a module, choose M here: the | 206 | To compile this driver as a module, choose M here: the |
207 | module will be called ide-cd. | 207 | module will be called ide-cd. |
208 | 208 | ||
209 | config BLK_DEV_IDECD_VERBOSE_ERRORS | 209 | config BLK_DEV_IDECD_VERBOSE_ERRORS |
210 | bool "Verbose error logging for IDE/ATAPI CDROM driver" if EMBEDDED | 210 | bool "Verbose error logging for IDE/ATAPI CDROM driver" if EMBEDDED |
211 | depends on BLK_DEV_IDECD | 211 | depends on BLK_DEV_IDECD |
212 | default y | 212 | default y |
213 | help | 213 | help |
214 | Turn this on to have the driver print out the meanings of the | 214 | Turn this on to have the driver print out the meanings of the |
215 | ATAPI error codes. This will use up additional 8kB of kernel-space | 215 | ATAPI error codes. This will use up additional 8kB of kernel-space |
216 | memory, though. | 216 | memory, though. |
217 | 217 | ||
218 | config BLK_DEV_IDETAPE | 218 | config BLK_DEV_IDETAPE |
219 | tristate "Include IDE/ATAPI TAPE support" | 219 | tristate "Include IDE/ATAPI TAPE support" |
220 | help | 220 | help |
221 | If you have an IDE tape drive using the ATAPI protocol, say Y. | 221 | If you have an IDE tape drive using the ATAPI protocol, say Y. |
222 | ATAPI is a newer protocol used by IDE tape and CD-ROM drives, | 222 | ATAPI is a newer protocol used by IDE tape and CD-ROM drives, |
223 | similar to the SCSI protocol. If you have an SCSI tape drive | 223 | similar to the SCSI protocol. If you have an SCSI tape drive |
224 | however, you can say N here. | 224 | however, you can say N here. |
225 | 225 | ||
226 | You should also say Y if you have an OnStream DI-30 tape drive; this | 226 | You should also say Y if you have an OnStream DI-30 tape drive; this |
227 | will not work with the SCSI protocol, until there is support for the | 227 | will not work with the SCSI protocol, until there is support for the |
228 | SC-30 and SC-50 versions. | 228 | SC-30 and SC-50 versions. |
229 | 229 | ||
230 | If you say Y here, the tape drive will be identified at boot time | 230 | If you say Y here, the tape drive will be identified at boot time |
231 | along with other IDE devices, as "hdb" or "hdc", or something | 231 | along with other IDE devices, as "hdb" or "hdc", or something |
232 | similar, and will be mapped to a character device such as "ht0" | 232 | similar, and will be mapped to a character device such as "ht0" |
233 | (check the boot messages with dmesg). Be sure to consult the | 233 | (check the boot messages with dmesg). Be sure to consult the |
234 | <file:drivers/ide/ide-tape.c> and <file:Documentation/ide.txt> files | 234 | <file:drivers/ide/ide-tape.c> and <file:Documentation/ide.txt> files |
235 | for usage information. | 235 | for usage information. |
236 | 236 | ||
237 | To compile this driver as a module, choose M here: the | 237 | To compile this driver as a module, choose M here: the |
238 | module will be called ide-tape. | 238 | module will be called ide-tape. |
239 | 239 | ||
240 | config BLK_DEV_IDEFLOPPY | 240 | config BLK_DEV_IDEFLOPPY |
241 | tristate "Include IDE/ATAPI FLOPPY support" | 241 | tristate "Include IDE/ATAPI FLOPPY support" |
242 | ---help--- | 242 | ---help--- |
243 | If you have an IDE floppy drive which uses the ATAPI protocol, | 243 | If you have an IDE floppy drive which uses the ATAPI protocol, |
244 | answer Y. ATAPI is a newer protocol used by IDE CD-ROM/tape/floppy | 244 | answer Y. ATAPI is a newer protocol used by IDE CD-ROM/tape/floppy |
245 | drives, similar to the SCSI protocol. | 245 | drives, similar to the SCSI protocol. |
246 | 246 | ||
247 | The LS-120 and the IDE/ATAPI Iomega ZIP drive are also supported by | 247 | The LS-120 and the IDE/ATAPI Iomega ZIP drive are also supported by |
248 | this driver. For information about jumper settings and the question | 248 | this driver. For information about jumper settings and the question |
249 | of when a ZIP drive uses a partition table, see | 249 | of when a ZIP drive uses a partition table, see |
250 | <http://www.win.tue.nl/~aeb/linux/zip/zip-1.html>. | 250 | <http://www.win.tue.nl/~aeb/linux/zip/zip-1.html>. |
251 | (ATAPI PD-CD/CDR drives are not supported by this driver; support | 251 | (ATAPI PD-CD/CDR drives are not supported by this driver; support |
252 | for PD-CD/CDR drives is available if you answer Y to | 252 | for PD-CD/CDR drives is available if you answer Y to |
253 | "SCSI emulation support", below). | 253 | "SCSI emulation support", below). |
254 | 254 | ||
255 | If you say Y here, the FLOPPY drive will be identified along with | 255 | If you say Y here, the FLOPPY drive will be identified along with |
256 | other IDE devices, as "hdb" or "hdc", or something similar (check | 256 | other IDE devices, as "hdb" or "hdc", or something similar (check |
257 | the boot messages with dmesg). | 257 | the boot messages with dmesg). |
258 | 258 | ||
259 | To compile this driver as a module, choose M here: the | 259 | To compile this driver as a module, choose M here: the |
260 | module will be called ide-floppy. | 260 | module will be called ide-floppy. |
261 | 261 | ||
262 | config BLK_DEV_IDESCSI | 262 | config BLK_DEV_IDESCSI |
263 | tristate "SCSI emulation support" | 263 | tristate "SCSI emulation support" |
264 | depends on SCSI | 264 | depends on SCSI |
265 | ---help--- | 265 | ---help--- |
266 | WARNING: ide-scsi is no longer needed for cd writing applications! | 266 | WARNING: ide-scsi is no longer needed for cd writing applications! |
267 | The 2.6 kernel supports direct writing to ide-cd, which eliminates | 267 | The 2.6 kernel supports direct writing to ide-cd, which eliminates |
268 | the need for ide-scsi + the entire scsi stack just for writing a | 268 | the need for ide-scsi + the entire scsi stack just for writing a |
269 | cd. The new method is more efficient in every way. | 269 | cd. The new method is more efficient in every way. |
270 | 270 | ||
271 | This will provide SCSI host adapter emulation for IDE ATAPI devices, | 271 | This will provide SCSI host adapter emulation for IDE ATAPI devices, |
272 | and will allow you to use a SCSI device driver instead of a native | 272 | and will allow you to use a SCSI device driver instead of a native |
273 | ATAPI driver. | 273 | ATAPI driver. |
274 | 274 | ||
275 | This is useful if you have an ATAPI device for which no native | 275 | This is useful if you have an ATAPI device for which no native |
276 | driver has been written (for example, an ATAPI PD-CD drive); | 276 | driver has been written (for example, an ATAPI PD-CD drive); |
277 | you can then use this emulation together with an appropriate SCSI | 277 | you can then use this emulation together with an appropriate SCSI |
278 | device driver. In order to do this, say Y here and to "SCSI support" | 278 | device driver. In order to do this, say Y here and to "SCSI support" |
279 | and "SCSI generic support", below. You must then provide the kernel | 279 | and "SCSI generic support", below. You must then provide the kernel |
280 | command line "hdx=ide-scsi" (try "man bootparam" or see the | 280 | command line "hdx=ide-scsi" (try "man bootparam" or see the |
281 | documentation of your boot loader (lilo or loadlin) about how to | 281 | documentation of your boot loader (lilo or loadlin) about how to |
282 | pass options to the kernel at boot time) for devices if you want the | 282 | pass options to the kernel at boot time) for devices if you want the |
283 | native EIDE sub-drivers to skip over the native support, so that | 283 | native EIDE sub-drivers to skip over the native support, so that |
284 | this SCSI emulation can be used instead. | 284 | this SCSI emulation can be used instead. |
285 | 285 | ||
286 | Note that this option does NOT allow you to attach SCSI devices to a | 286 | Note that this option does NOT allow you to attach SCSI devices to a |
287 | box that doesn't have a SCSI host adapter installed. | 287 | box that doesn't have a SCSI host adapter installed. |
288 | 288 | ||
289 | If both this SCSI emulation and native ATAPI support are compiled | 289 | If both this SCSI emulation and native ATAPI support are compiled |
290 | into the kernel, the native support will be used. | 290 | into the kernel, the native support will be used. |
291 | 291 | ||
292 | config BLK_DEV_IDEACPI | 292 | config BLK_DEV_IDEACPI |
293 | bool "IDE ACPI support" | 293 | bool "IDE ACPI support" |
294 | depends on ACPI | 294 | depends on ACPI |
295 | ---help--- | 295 | ---help--- |
296 | Implement ACPI support for generic IDE devices. On modern | 296 | Implement ACPI support for generic IDE devices. On modern |
297 | machines ACPI support is required to properly handle ACPI S3 states. | 297 | machines ACPI support is required to properly handle ACPI S3 states. |
298 | 298 | ||
299 | config IDE_TASK_IOCTL | 299 | config IDE_TASK_IOCTL |
300 | bool "IDE Taskfile Access" | 300 | bool "IDE Taskfile Access" |
301 | help | 301 | help |
302 | This is a direct raw access to the media. It is a complex but | 302 | This is a direct raw access to the media. It is a complex but |
303 | elegant solution to test and validate the domain of the hardware and | 303 | elegant solution to test and validate the domain of the hardware and |
304 | perform below the driver data recovery if needed. This is the most | 304 | perform below the driver data recovery if needed. This is the most |
305 | basic form of media-forensics. | 305 | basic form of media-forensics. |
306 | 306 | ||
307 | If you are unsure, say N here. | 307 | If you are unsure, say N here. |
308 | 308 | ||
309 | config IDE_PROC_FS | 309 | config IDE_PROC_FS |
310 | bool "legacy /proc/ide/ support" | 310 | bool "legacy /proc/ide/ support" |
311 | depends on IDE && PROC_FS | 311 | depends on IDE && PROC_FS |
312 | default y | 312 | default y |
313 | help | 313 | help |
314 | This option enables support for the various files in | 314 | This option enables support for the various files in |
315 | /proc/ide. In Linux 2.6 this has been superseded by | 315 | /proc/ide. In Linux 2.6 this has been superseded by |
316 | files in sysfs but many legacy applications rely on this. | 316 | files in sysfs but many legacy applications rely on this. |
317 | 317 | ||
318 | If unsure say Y. | 318 | If unsure say Y. |
319 | 319 | ||
320 | comment "IDE chipset support/bugfixes" | 320 | comment "IDE chipset support/bugfixes" |
321 | 321 | ||
322 | config IDE_GENERIC | 322 | config IDE_GENERIC |
323 | tristate "generic/default IDE chipset support" | 323 | tristate "generic/default IDE chipset support" |
324 | help | 324 | help |
325 | If unsure, say N. | 325 | If unsure, say N. |
326 | 326 | ||
327 | config BLK_DEV_PLATFORM | 327 | config BLK_DEV_PLATFORM |
328 | tristate "Platform driver for IDE interfaces" | 328 | tristate "Platform driver for IDE interfaces" |
329 | help | 329 | help |
330 | This is the platform IDE driver, used mostly for Memory Mapped | 330 | This is the platform IDE driver, used mostly for Memory Mapped |
331 | IDE devices, like Compact Flashes running in True IDE mode. | 331 | IDE devices, like Compact Flashes running in True IDE mode. |
332 | 332 | ||
333 | If unsure, say N. | 333 | If unsure, say N. |
334 | 334 | ||
335 | config BLK_DEV_CMD640 | 335 | config BLK_DEV_CMD640 |
336 | tristate "CMD640 chipset bugfix/support" | 336 | tristate "CMD640 chipset bugfix/support" |
337 | depends on X86 | 337 | depends on X86 |
338 | ---help--- | 338 | ---help--- |
339 | The CMD-Technologies CMD640 IDE chip is used on many common 486 and | 339 | The CMD-Technologies CMD640 IDE chip is used on many common 486 and |
340 | Pentium motherboards, usually in combination with a "Neptune" or | 340 | Pentium motherboards, usually in combination with a "Neptune" or |
341 | "SiS" chipset. Unfortunately, it has a number of rather nasty | 341 | "SiS" chipset. Unfortunately, it has a number of rather nasty |
342 | design flaws that can cause severe data corruption under many common | 342 | design flaws that can cause severe data corruption under many common |
343 | conditions. Say Y here to include code which tries to automatically | 343 | conditions. Say Y here to include code which tries to automatically |
344 | detect and correct the problems under Linux. This option also | 344 | detect and correct the problems under Linux. This option also |
345 | enables access to the secondary IDE ports in some CMD640 based | 345 | enables access to the secondary IDE ports in some CMD640 based |
346 | systems. | 346 | systems. |
347 | 347 | ||
348 | This driver will work automatically in PCI based systems (most new | 348 | This driver will work automatically in PCI based systems (most new |
349 | systems have PCI slots). But if your system uses VESA local bus | 349 | systems have PCI slots). But if your system uses VESA local bus |
350 | (VLB) instead of PCI, you must also supply a kernel boot parameter | 350 | (VLB) instead of PCI, you must also supply a kernel boot parameter |
351 | to enable the CMD640 bugfix/support: "ide0=cmd640_vlb". (Try "man | 351 | to enable the CMD640 bugfix/support: "ide0=cmd640_vlb". (Try "man |
352 | bootparam" or see the documentation of your boot loader about how to | 352 | bootparam" or see the documentation of your boot loader about how to |
353 | pass options to the kernel.) | 353 | pass options to the kernel.) |
354 | 354 | ||
355 | The CMD640 chip is also used on add-in cards by Acculogic, and on | 355 | The CMD640 chip is also used on add-in cards by Acculogic, and on |
356 | the "CSA-6400E PCI to IDE controller" that some people have. For | 356 | the "CSA-6400E PCI to IDE controller" that some people have. For |
357 | details, read <file:Documentation/ide.txt>. | 357 | details, read <file:Documentation/ide.txt>. |
358 | 358 | ||
359 | config BLK_DEV_CMD640_ENHANCED | 359 | config BLK_DEV_CMD640_ENHANCED |
360 | bool "CMD640 enhanced support" | 360 | bool "CMD640 enhanced support" |
361 | depends on BLK_DEV_CMD640 | 361 | depends on BLK_DEV_CMD640 |
362 | help | 362 | help |
363 | This option includes support for setting/autotuning PIO modes and | 363 | This option includes support for setting/autotuning PIO modes and |
364 | prefetch on CMD640 IDE interfaces. For details, read | 364 | prefetch on CMD640 IDE interfaces. For details, read |
365 | <file:Documentation/ide.txt>. If you have a CMD640 IDE interface | 365 | <file:Documentation/ide.txt>. If you have a CMD640 IDE interface |
366 | and your BIOS does not already do this for you, then say Y here. | 366 | and your BIOS does not already do this for you, then say Y here. |
367 | Otherwise say N. | 367 | Otherwise say N. |
368 | 368 | ||
369 | config BLK_DEV_IDEPNP | 369 | config BLK_DEV_IDEPNP |
370 | tristate "PNP EIDE support" | 370 | tristate "PNP EIDE support" |
371 | depends on PNP | 371 | depends on PNP |
372 | help | 372 | help |
373 | If you have a PnP (Plug and Play) compatible EIDE card and | 373 | If you have a PnP (Plug and Play) compatible EIDE card and |
374 | would like the kernel to automatically detect and activate | 374 | would like the kernel to automatically detect and activate |
375 | it, say Y here. | 375 | it, say Y here. |
376 | 376 | ||
377 | if PCI | 377 | if PCI |
378 | 378 | ||
379 | comment "PCI IDE chipsets support" | 379 | comment "PCI IDE chipsets support" |
380 | 380 | ||
381 | config BLK_DEV_IDEPCI | 381 | config BLK_DEV_IDEPCI |
382 | bool | 382 | bool |
383 | 383 | ||
384 | config IDEPCI_PCIBUS_ORDER | 384 | config IDEPCI_PCIBUS_ORDER |
385 | bool "Probe IDE PCI devices in the PCI bus order (DEPRECATED)" | 385 | bool "Probe IDE PCI devices in the PCI bus order (DEPRECATED)" |
386 | depends on BLK_DEV_IDE=y && BLK_DEV_IDEPCI | 386 | depends on BLK_DEV_IDE=y && BLK_DEV_IDEPCI |
387 | default y | 387 | default y |
388 | help | 388 | help |
389 | Probe IDE PCI devices in the order in which they appear on the | 389 | Probe IDE PCI devices in the order in which they appear on the |
390 | PCI bus (i.e. 00:1f.1 PCI device before 02:01.0 PCI device) | 390 | PCI bus (i.e. 00:1f.1 PCI device before 02:01.0 PCI device) |
391 | instead of the order in which IDE PCI host drivers are loaded. | 391 | instead of the order in which IDE PCI host drivers are loaded. |
392 | 392 | ||
393 | Please note that this method of assuring stable naming of | 393 | Please note that this method of assuring stable naming of |
394 | IDE devices is unreliable and use other means for achieving | 394 | IDE devices is unreliable and use other means for achieving |
395 | it (i.e. udev). | 395 | it (i.e. udev). |
396 | 396 | ||
397 | If in doubt, say N. | 397 | If in doubt, say N. |
398 | 398 | ||
399 | # TODO: split it on per host driver config options (or module parameters) | 399 | # TODO: split it on per host driver config options (or module parameters) |
400 | config BLK_DEV_OFFBOARD | 400 | config BLK_DEV_OFFBOARD |
401 | bool "Boot off-board chipsets first support (DEPRECATED)" | 401 | bool "Boot off-board chipsets first support (DEPRECATED)" |
402 | depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001) | 402 | depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001) |
403 | help | 403 | help |
404 | Normally, IDE controllers built into the motherboard (on-board | 404 | Normally, IDE controllers built into the motherboard (on-board |
405 | controllers) are assigned to ide0 and ide1 while those on add-in PCI | 405 | controllers) are assigned to ide0 and ide1 while those on add-in PCI |
406 | cards (off-board controllers) are relegated to ide2 and ide3. | 406 | cards (off-board controllers) are relegated to ide2 and ide3. |
407 | Answering Y here will allow you to reverse the situation, with | 407 | Answering Y here will allow you to reverse the situation, with |
408 | off-board controllers on ide0/1 and on-board controllers on ide2/3. | 408 | off-board controllers on ide0/1 and on-board controllers on ide2/3. |
409 | This can improve the usability of some boot managers such as lilo | 409 | This can improve the usability of some boot managers such as lilo |
410 | when booting from a drive on an off-board controller. | 410 | when booting from a drive on an off-board controller. |
411 | 411 | ||
412 | If you say Y here, and you actually want to reverse the device scan | 412 | If you say Y here, and you actually want to reverse the device scan |
413 | order as explained above, you also need to issue the kernel command | 413 | order as explained above, you also need to issue the kernel command |
414 | line option "ide=reverse". (Try "man bootparam" or see the | 414 | line option "ide=reverse". (Try "man bootparam" or see the |
415 | documentation of your boot loader (lilo or loadlin) about how to | 415 | documentation of your boot loader (lilo or loadlin) about how to |
416 | pass options to the kernel at boot time.) | 416 | pass options to the kernel at boot time.) |
417 | 417 | ||
418 | Note that, if you do this, the order of the hd* devices will be | 418 | Note that, if you do this, the order of the hd* devices will be |
419 | rearranged which may require modification of fstab and other files. | 419 | rearranged which may require modification of fstab and other files. |
420 | 420 | ||
421 | Please also note that this method of assuring stable naming of | 421 | Please also note that this method of assuring stable naming of |
422 | IDE devices is unreliable and use other means for achieving it | 422 | IDE devices is unreliable and use other means for achieving it |
423 | (i.e. udev). | 423 | (i.e. udev). |
424 | 424 | ||
425 | If in doubt, say N. | 425 | If in doubt, say N. |
426 | 426 | ||
427 | config BLK_DEV_GENERIC | 427 | config BLK_DEV_GENERIC |
428 | tristate "Generic PCI IDE Chipset Support" | 428 | tristate "Generic PCI IDE Chipset Support" |
429 | select BLK_DEV_IDEPCI | 429 | select BLK_DEV_IDEPCI |
430 | help | 430 | help |
431 | This option provides generic support for various PCI IDE Chipsets | 431 | This option provides generic support for various PCI IDE Chipsets |
432 | which otherwise might not be supported. | 432 | which otherwise might not be supported. |
433 | 433 | ||
434 | config BLK_DEV_OPTI621 | 434 | config BLK_DEV_OPTI621 |
435 | tristate "OPTi 82C621 chipset enhanced support (EXPERIMENTAL)" | 435 | tristate "OPTi 82C621 chipset enhanced support (EXPERIMENTAL)" |
436 | depends on EXPERIMENTAL | 436 | depends on EXPERIMENTAL |
437 | select BLK_DEV_IDEPCI | 437 | select BLK_DEV_IDEPCI |
438 | help | 438 | help |
439 | This is a driver for the OPTi 82C621 EIDE controller. | 439 | This is a driver for the OPTi 82C621 EIDE controller. |
440 | Please read the comments at the top of <file:drivers/ide/pci/opti621.c>. | 440 | Please read the comments at the top of <file:drivers/ide/pci/opti621.c>. |
441 | 441 | ||
442 | config BLK_DEV_RZ1000 | 442 | config BLK_DEV_RZ1000 |
443 | tristate "RZ1000 chipset bugfix/support" | 443 | tristate "RZ1000 chipset bugfix/support" |
444 | depends on X86 | 444 | depends on X86 |
445 | select BLK_DEV_IDEPCI | 445 | select BLK_DEV_IDEPCI |
446 | help | 446 | help |
447 | The PC-Technologies RZ1000 IDE chip is used on many common 486 and | 447 | The PC-Technologies RZ1000 IDE chip is used on many common 486 and |
448 | Pentium motherboards, usually along with the "Neptune" chipset. | 448 | Pentium motherboards, usually along with the "Neptune" chipset. |
449 | Unfortunately, it has a rather nasty design flaw that can cause | 449 | Unfortunately, it has a rather nasty design flaw that can cause |
450 | severe data corruption under many conditions. Say Y here to include | 450 | severe data corruption under many conditions. Say Y here to include |
451 | code which automatically detects and corrects the problem under | 451 | code which automatically detects and corrects the problem under |
452 | Linux. This may slow disk throughput by a few percent, but at least | 452 | Linux. This may slow disk throughput by a few percent, but at least |
453 | things will operate 100% reliably. | 453 | things will operate 100% reliably. |
454 | 454 | ||
455 | config BLK_DEV_IDEDMA_PCI | 455 | config BLK_DEV_IDEDMA_PCI |
456 | bool | 456 | bool |
457 | select BLK_DEV_IDEPCI | 457 | select BLK_DEV_IDEPCI |
458 | 458 | ||
459 | config BLK_DEV_AEC62XX | 459 | config BLK_DEV_AEC62XX |
460 | tristate "AEC62XX chipset support" | 460 | tristate "AEC62XX chipset support" |
461 | select BLK_DEV_IDEDMA_PCI | 461 | select BLK_DEV_IDEDMA_PCI |
462 | help | 462 | help |
463 | This driver adds explicit support for Acard AEC62xx (Artop ATP8xx) | 463 | This driver adds explicit support for Acard AEC62xx (Artop ATP8xx) |
464 | IDE controllers. This allows the kernel to change PIO, DMA and UDMA | 464 | IDE controllers. This allows the kernel to change PIO, DMA and UDMA |
465 | speeds and to configure the chip to optimum performance. | 465 | speeds and to configure the chip to optimum performance. |
466 | 466 | ||
467 | config BLK_DEV_ALI15X3 | 467 | config BLK_DEV_ALI15X3 |
468 | tristate "ALI M15x3 chipset support" | 468 | tristate "ALI M15x3 chipset support" |
469 | select BLK_DEV_IDEDMA_PCI | 469 | select BLK_DEV_IDEDMA_PCI |
470 | help | 470 | help |
471 | This driver ensures (U)DMA support for ALI 1533, 1543 and 1543C | 471 | This driver ensures (U)DMA support for ALI 1533, 1543 and 1543C |
472 | onboard chipsets. It also tests for Simplex mode and enables | 472 | onboard chipsets. It also tests for Simplex mode and enables |
473 | normal dual channel support. | 473 | normal dual channel support. |
474 | 474 | ||
475 | If you say Y here, you also need to say Y to "Use DMA by default | 475 | If you say Y here, you also need to say Y to "Use DMA by default |
476 | when available", above. Please read the comments at the top of | 476 | when available", above. Please read the comments at the top of |
477 | <file:drivers/ide/pci/alim15x3.c>. | 477 | <file:drivers/ide/pci/alim15x3.c>. |
478 | 478 | ||
479 | If unsure, say N. | 479 | If unsure, say N. |
480 | 480 | ||
481 | config WDC_ALI15X3 | 481 | config WDC_ALI15X3 |
482 | bool "ALI M15x3 WDC support (DANGEROUS)" | 482 | bool "ALI M15x3 WDC support (DANGEROUS)" |
483 | depends on BLK_DEV_ALI15X3 | 483 | depends on BLK_DEV_ALI15X3 |
484 | ---help--- | 484 | ---help--- |
485 | This allows for UltraDMA support for WDC drives that ignore CRC | 485 | This allows for UltraDMA support for WDC drives that ignore CRC |
486 | checking. You are a fool for enabling this option, but there have | 486 | checking. You are a fool for enabling this option, but there have |
487 | been requests. DO NOT COMPLAIN IF YOUR DRIVE HAS FS CORRUPTION, IF | 487 | been requests. DO NOT COMPLAIN IF YOUR DRIVE HAS FS CORRUPTION, IF |
488 | YOU ENABLE THIS! No one will listen, just laugh for ignoring this | 488 | YOU ENABLE THIS! No one will listen, just laugh for ignoring this |
489 | SERIOUS WARNING. | 489 | SERIOUS WARNING. |
490 | 490 | ||
491 | Using this option can allow WDC drives to run at ATA-4/5 transfer | 491 | Using this option can allow WDC drives to run at ATA-4/5 transfer |
492 | rates with only an ATA-2 support structure. | 492 | rates with only an ATA-2 support structure. |
493 | 493 | ||
494 | SAY N! | 494 | SAY N! |
495 | 495 | ||
496 | config BLK_DEV_AMD74XX | 496 | config BLK_DEV_AMD74XX |
497 | tristate "AMD and nVidia IDE support" | 497 | tristate "AMD and nVidia IDE support" |
498 | depends on !ARM | 498 | depends on !ARM |
499 | select BLK_DEV_IDEDMA_PCI | 499 | select BLK_DEV_IDEDMA_PCI |
500 | help | 500 | help |
501 | This driver adds explicit support for AMD-7xx and AMD-8111 chips | 501 | This driver adds explicit support for AMD-7xx and AMD-8111 chips |
502 | and also for the nVidia nForce chip. This allows the kernel to | 502 | and also for the nVidia nForce chip. This allows the kernel to |
503 | change PIO, DMA and UDMA speeds and to configure the chip to | 503 | change PIO, DMA and UDMA speeds and to configure the chip to |
504 | optimum performance. | 504 | optimum performance. |
505 | 505 | ||
506 | config BLK_DEV_ATIIXP | 506 | config BLK_DEV_ATIIXP |
507 | tristate "ATI IXP chipset IDE support" | 507 | tristate "ATI IXP chipset IDE support" |
508 | depends on X86 | 508 | depends on X86 |
509 | select BLK_DEV_IDEDMA_PCI | 509 | select BLK_DEV_IDEDMA_PCI |
510 | help | 510 | help |
511 | This driver adds explicit support for ATI IXP chipset. | 511 | This driver adds explicit support for ATI IXP chipset. |
512 | This allows the kernel to change PIO, DMA and UDMA speeds | 512 | This allows the kernel to change PIO, DMA and UDMA speeds |
513 | and to configure the chip to optimum performance. | 513 | and to configure the chip to optimum performance. |
514 | 514 | ||
515 | Say Y here if you have an ATI IXP chipset IDE controller. | 515 | Say Y here if you have an ATI IXP chipset IDE controller. |
516 | 516 | ||
517 | config BLK_DEV_CMD64X | 517 | config BLK_DEV_CMD64X |
518 | tristate "CMD64{3|6|8|9} chipset support" | 518 | tristate "CMD64{3|6|8|9} chipset support" |
519 | select BLK_DEV_IDEDMA_PCI | 519 | select BLK_DEV_IDEDMA_PCI |
520 | help | 520 | help |
521 | Say Y here if you have an IDE controller which uses any of these | 521 | Say Y here if you have an IDE controller which uses any of these |
522 | chipsets: CMD643, CMD646, or CMD648. | 522 | chipsets: CMD643, CMD646, or CMD648. |
523 | 523 | ||
524 | config BLK_DEV_TRIFLEX | 524 | config BLK_DEV_TRIFLEX |
525 | tristate "Compaq Triflex IDE support" | 525 | tristate "Compaq Triflex IDE support" |
526 | select BLK_DEV_IDEDMA_PCI | 526 | select BLK_DEV_IDEDMA_PCI |
527 | help | 527 | help |
528 | Say Y here if you have a Compaq Triflex IDE controller, such | 528 | Say Y here if you have a Compaq Triflex IDE controller, such |
529 | as those commonly found on Compaq Pentium-Pro systems | 529 | as those commonly found on Compaq Pentium-Pro systems |
530 | 530 | ||
531 | config BLK_DEV_CY82C693 | 531 | config BLK_DEV_CY82C693 |
532 | tristate "CY82C693 chipset support" | 532 | tristate "CY82C693 chipset support" |
533 | select BLK_DEV_IDEDMA_PCI | 533 | select BLK_DEV_IDEDMA_PCI |
534 | help | 534 | help |
535 | This driver adds detection and support for the CY82C693 chipset | 535 | This driver adds detection and support for the CY82C693 chipset |
536 | used on Digital's PC-Alpha 164SX boards. | 536 | used on Digital's PC-Alpha 164SX boards. |
537 | 537 | ||
538 | If you say Y here, you need to say Y to "Use DMA by default | 538 | If you say Y here, you need to say Y to "Use DMA by default |
539 | when available" as well. | 539 | when available" as well. |
540 | 540 | ||
541 | config BLK_DEV_CS5520 | 541 | config BLK_DEV_CS5520 |
542 | tristate "Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTAL)" | 542 | tristate "Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTAL)" |
543 | depends on EXPERIMENTAL | 543 | depends on EXPERIMENTAL |
544 | select BLK_DEV_IDEDMA_PCI | 544 | select BLK_DEV_IDEDMA_PCI |
545 | help | 545 | help |
546 | Include support for PIO tuning and virtual DMA on the Cyrix MediaGX | 546 | Include support for PIO tuning and virtual DMA on the Cyrix MediaGX |
547 | 5510/5520 chipset. This will automatically be detected and | 547 | 5510/5520 chipset. This will automatically be detected and |
548 | configured if found. | 548 | configured if found. |
549 | 549 | ||
550 | It is safe to say Y to this question. | 550 | It is safe to say Y to this question. |
551 | 551 | ||
552 | config BLK_DEV_CS5530 | 552 | config BLK_DEV_CS5530 |
553 | tristate "Cyrix/National Semiconductor CS5530 MediaGX chipset support" | 553 | tristate "Cyrix/National Semiconductor CS5530 MediaGX chipset support" |
554 | select BLK_DEV_IDEDMA_PCI | 554 | select BLK_DEV_IDEDMA_PCI |
555 | help | 555 | help |
556 | Include support for UDMA on the Cyrix MediaGX 5530 chipset. This | 556 | Include support for UDMA on the Cyrix MediaGX 5530 chipset. This |
557 | will automatically be detected and configured if found. | 557 | will automatically be detected and configured if found. |
558 | 558 | ||
559 | It is safe to say Y to this question. | 559 | It is safe to say Y to this question. |
560 | 560 | ||
561 | config BLK_DEV_CS5535 | 561 | config BLK_DEV_CS5535 |
562 | tristate "AMD CS5535 chipset support" | 562 | tristate "AMD CS5535 chipset support" |
563 | depends on X86 && !X86_64 | 563 | depends on X86 && !X86_64 |
564 | select BLK_DEV_IDEDMA_PCI | 564 | select BLK_DEV_IDEDMA_PCI |
565 | help | 565 | help |
566 | Include support for UDMA on the NSC/AMD CS5535 companion chipset. | 566 | Include support for UDMA on the NSC/AMD CS5535 companion chipset. |
567 | This will automatically be detected and configured if found. | 567 | This will automatically be detected and configured if found. |
568 | 568 | ||
569 | It is safe to say Y to this question. | 569 | It is safe to say Y to this question. |
570 | 570 | ||
571 | config BLK_DEV_HPT34X | 571 | config BLK_DEV_HPT34X |
572 | tristate "HPT34X chipset support" | 572 | tristate "HPT34X chipset support" |
573 | select BLK_DEV_IDEDMA_PCI | 573 | select BLK_DEV_IDEDMA_PCI |
574 | help | 574 | help |
575 | This driver adds up to 4 more EIDE devices sharing a single | 575 | This driver adds up to 4 more EIDE devices sharing a single |
576 | interrupt. The HPT343 chipset in its current form is a non-bootable | 576 | interrupt. The HPT343 chipset in its current form is a non-bootable |
577 | controller; the HPT345/HPT363 chipset is a bootable (needs BIOS FIX) | 577 | controller; the HPT345/HPT363 chipset is a bootable (needs BIOS FIX) |
578 | PCI UDMA controllers. This driver requires dynamic tuning of the | 578 | PCI UDMA controllers. This driver requires dynamic tuning of the |
579 | chipset during the ide-probe at boot time. It is reported to support | 579 | chipset during the ide-probe at boot time. It is reported to support |
580 | DVD II drives, by the manufacturer. | 580 | DVD II drives, by the manufacturer. |
581 | 581 | ||
582 | config HPT34X_AUTODMA | 582 | config HPT34X_AUTODMA |
583 | bool "HPT34X AUTODMA support (EXPERIMENTAL)" | 583 | bool "HPT34X AUTODMA support (EXPERIMENTAL)" |
584 | depends on BLK_DEV_HPT34X && EXPERIMENTAL | 584 | depends on BLK_DEV_HPT34X && EXPERIMENTAL |
585 | help | 585 | help |
586 | This is a dangerous thing to attempt currently! Please read the | 586 | This is a dangerous thing to attempt currently! Please read the |
587 | comments at the top of <file:drivers/ide/pci/hpt34x.c>. If you say Y | 587 | comments at the top of <file:drivers/ide/pci/hpt34x.c>. If you say Y |
588 | here, then say Y to "Use DMA by default when available" as well. | 588 | here, then say Y to "Use DMA by default when available" as well. |
589 | 589 | ||
590 | If unsure, say N. | 590 | If unsure, say N. |
591 | 591 | ||
592 | config BLK_DEV_HPT366 | 592 | config BLK_DEV_HPT366 |
593 | tristate "HPT36X/37X chipset support" | 593 | tristate "HPT36X/37X chipset support" |
594 | select BLK_DEV_IDEDMA_PCI | 594 | select BLK_DEV_IDEDMA_PCI |
595 | help | 595 | help |
596 | HPT366 is an Ultra DMA chipset for ATA-66. | 596 | HPT366 is an Ultra DMA chipset for ATA-66. |
597 | HPT368 is an Ultra DMA chipset for ATA-66 RAID Based. | 597 | HPT368 is an Ultra DMA chipset for ATA-66 RAID Based. |
598 | HPT370 is an Ultra DMA chipset for ATA-100. | 598 | HPT370 is an Ultra DMA chipset for ATA-100. |
599 | HPT372 is an Ultra DMA chipset for ATA-100. | 599 | HPT372 is an Ultra DMA chipset for ATA-100. |
600 | HPT374 is an Ultra DMA chipset for ATA-100. | 600 | HPT374 is an Ultra DMA chipset for ATA-100. |
601 | 601 | ||
602 | This driver adds up to 4 more EIDE devices sharing a single | 602 | This driver adds up to 4 more EIDE devices sharing a single |
603 | interrupt. | 603 | interrupt. |
604 | 604 | ||
605 | The HPT366 chipset in its current form is bootable. One solution | 605 | The HPT366 chipset in its current form is bootable. One solution |
606 | for this problem are special LILO commands for redirecting the | 606 | for this problem are special LILO commands for redirecting the |
607 | reference to device 0x80. The other solution is to say Y to "Boot | 607 | reference to device 0x80. The other solution is to say Y to "Boot |
608 | off-board chipsets first support" (CONFIG_BLK_DEV_OFFBOARD) unless | 608 | off-board chipsets first support" (CONFIG_BLK_DEV_OFFBOARD) unless |
609 | your mother board has the chipset natively mounted. Regardless one | 609 | your mother board has the chipset natively mounted. Regardless one |
610 | should use the fore mentioned option and call at LILO or include | 610 | should use the fore mentioned option and call at LILO or include |
611 | "ide=reverse" in LILO's append-line. | 611 | "ide=reverse" in LILO's append-line. |
612 | 612 | ||
613 | This driver requires dynamic tuning of the chipset during the | 613 | This driver requires dynamic tuning of the chipset during the |
614 | ide-probe at boot. It is reported to support DVD II drives, by the | 614 | ide-probe at boot. It is reported to support DVD II drives, by the |
615 | manufacturer. | 615 | manufacturer. |
616 | 616 | ||
617 | config BLK_DEV_JMICRON | 617 | config BLK_DEV_JMICRON |
618 | tristate "JMicron JMB36x support" | 618 | tristate "JMicron JMB36x support" |
619 | select BLK_DEV_IDEDMA_PCI | 619 | select BLK_DEV_IDEDMA_PCI |
620 | help | 620 | help |
621 | Basic support for the JMicron ATA controllers. For full support | 621 | Basic support for the JMicron ATA controllers. For full support |
622 | use the libata drivers. | 622 | use the libata drivers. |
623 | 623 | ||
624 | config BLK_DEV_SC1200 | 624 | config BLK_DEV_SC1200 |
625 | tristate "National SCx200 chipset support" | 625 | tristate "National SCx200 chipset support" |
626 | select BLK_DEV_IDEDMA_PCI | 626 | select BLK_DEV_IDEDMA_PCI |
627 | help | 627 | help |
628 | This driver adds support for the on-board IDE controller on the | 628 | This driver adds support for the on-board IDE controller on the |
629 | National SCx200 series of embedded x86 "Geode" systems. | 629 | National SCx200 series of embedded x86 "Geode" systems. |
630 | 630 | ||
631 | config BLK_DEV_PIIX | 631 | config BLK_DEV_PIIX |
632 | tristate "Intel PIIXn chipsets support" | 632 | tristate "Intel PIIXn chipsets support" |
633 | select BLK_DEV_IDEDMA_PCI | 633 | select BLK_DEV_IDEDMA_PCI |
634 | help | 634 | help |
635 | This driver adds explicit support for Intel PIIX and ICH chips | 635 | This driver adds explicit support for Intel PIIX and ICH chips |
636 | and also for the Efar Victory66 (slc90e66) chip. This allows | 636 | and also for the Efar Victory66 (slc90e66) chip. This allows |
637 | the kernel to change PIO, DMA and UDMA speeds and to configure | 637 | the kernel to change PIO, DMA and UDMA speeds and to configure |
638 | the chip to optimum performance. | 638 | the chip to optimum performance. |
639 | 639 | ||
640 | config BLK_DEV_IT8213 | 640 | config BLK_DEV_IT8213 |
641 | tristate "IT8213 IDE support" | 641 | tristate "IT8213 IDE support" |
642 | select BLK_DEV_IDEDMA_PCI | 642 | select BLK_DEV_IDEDMA_PCI |
643 | help | 643 | help |
644 | This driver adds support for the ITE 8213 IDE controller. | 644 | This driver adds support for the ITE 8213 IDE controller. |
645 | 645 | ||
646 | config BLK_DEV_IT821X | 646 | config BLK_DEV_IT821X |
647 | tristate "IT821X IDE support" | 647 | tristate "IT821X IDE support" |
648 | select BLK_DEV_IDEDMA_PCI | 648 | select BLK_DEV_IDEDMA_PCI |
649 | help | 649 | help |
650 | This driver adds support for the ITE 8211 IDE controller and the | 650 | This driver adds support for the ITE 8211 IDE controller and the |
651 | IT 8212 IDE RAID controller in both RAID and pass-through mode. | 651 | IT 8212 IDE RAID controller in both RAID and pass-through mode. |
652 | 652 | ||
653 | config BLK_DEV_NS87415 | 653 | config BLK_DEV_NS87415 |
654 | tristate "NS87415 chipset support" | 654 | tristate "NS87415 chipset support" |
655 | select BLK_DEV_IDEDMA_PCI | 655 | select BLK_DEV_IDEDMA_PCI |
656 | help | 656 | help |
657 | This driver adds detection and support for the NS87415 chip | 657 | This driver adds detection and support for the NS87415 chip |
658 | (used mainly on SPARC64 and PA-RISC machines). | 658 | (used mainly on SPARC64 and PA-RISC machines). |
659 | 659 | ||
660 | Please read the comments at the top of <file:drivers/ide/pci/ns87415.c>. | 660 | Please read the comments at the top of <file:drivers/ide/pci/ns87415.c>. |
661 | 661 | ||
662 | config BLK_DEV_PDC202XX_OLD | 662 | config BLK_DEV_PDC202XX_OLD |
663 | tristate "PROMISE PDC202{46|62|65|67} support" | 663 | tristate "PROMISE PDC202{46|62|65|67} support" |
664 | select BLK_DEV_IDEDMA_PCI | 664 | select BLK_DEV_IDEDMA_PCI |
665 | help | 665 | help |
666 | Promise Ultra33 or PDC20246 | 666 | Promise Ultra33 or PDC20246 |
667 | Promise Ultra66 or PDC20262 | 667 | Promise Ultra66 or PDC20262 |
668 | Promise Ultra100 or PDC20265/PDC20267/PDC20268 | 668 | Promise Ultra100 or PDC20265/PDC20267/PDC20268 |
669 | 669 | ||
670 | This driver adds up to 4 more EIDE devices sharing a single | 670 | This driver adds up to 4 more EIDE devices sharing a single |
671 | interrupt. This add-on card is a bootable PCI UDMA controller. Since | 671 | interrupt. This add-on card is a bootable PCI UDMA controller. Since |
672 | multiple cards can be installed and there are BIOS ROM problems that | 672 | multiple cards can be installed and there are BIOS ROM problems that |
673 | happen if the BIOS revisions of all installed cards (three-max) do | 673 | happen if the BIOS revisions of all installed cards (three-max) do |
674 | not match, the driver attempts to do dynamic tuning of the chipset | 674 | not match, the driver attempts to do dynamic tuning of the chipset |
675 | at boot-time for max-speed. Ultra33 BIOS 1.25 or newer is required | 675 | at boot-time for max-speed. Ultra33 BIOS 1.25 or newer is required |
676 | for more than one card. This card may require that you say Y to | 676 | for more than one card. This card may require that you say Y to |
677 | "Special UDMA Feature". | 677 | "Special UDMA Feature". |
678 | 678 | ||
679 | If you say Y here, you need to say Y to "Use DMA by default when | 679 | If you say Y here, you need to say Y to "Use DMA by default when |
680 | available" as well. | 680 | available" as well. |
681 | 681 | ||
682 | Please read the comments at the top of | 682 | Please read the comments at the top of |
683 | <file:drivers/ide/pci/pdc202xx_old.c>. | 683 | <file:drivers/ide/pci/pdc202xx_old.c>. |
684 | 684 | ||
685 | If unsure, say N. | 685 | If unsure, say N. |
686 | 686 | ||
687 | config PDC202XX_BURST | 687 | config PDC202XX_BURST |
688 | bool "Special UDMA Feature" | 688 | bool "Special UDMA Feature" |
689 | depends on BLK_DEV_PDC202XX_OLD | 689 | depends on BLK_DEV_PDC202XX_OLD |
690 | help | 690 | help |
691 | This option causes the pdc202xx driver to enable UDMA modes on the | 691 | This option causes the pdc202xx driver to enable UDMA modes on the |
692 | PDC202xx even when the PDC202xx BIOS has not done so. | 692 | PDC202xx even when the PDC202xx BIOS has not done so. |
693 | 693 | ||
694 | It was originally designed for the PDC20246/Ultra33, whose BIOS will | 694 | It was originally designed for the PDC20246/Ultra33, whose BIOS will |
695 | only setup UDMA on the first two PDC20246 cards. It has also been | 695 | only setup UDMA on the first two PDC20246 cards. It has also been |
696 | used successfully on a PDC20265/Ultra100, allowing use of UDMA modes | 696 | used successfully on a PDC20265/Ultra100, allowing use of UDMA modes |
697 | when the PDC20265 BIOS has been disabled (for faster boot up). | 697 | when the PDC20265 BIOS has been disabled (for faster boot up). |
698 | 698 | ||
699 | Please read the comments at the top of | 699 | Please read the comments at the top of |
700 | <file:drivers/ide/pci/pdc202xx_old.c>. | 700 | <file:drivers/ide/pci/pdc202xx_old.c>. |
701 | 701 | ||
702 | If unsure, say N. | 702 | If unsure, say N. |
703 | 703 | ||
704 | config BLK_DEV_PDC202XX_NEW | 704 | config BLK_DEV_PDC202XX_NEW |
705 | tristate "PROMISE PDC202{68|69|70|71|75|76|77} support" | 705 | tristate "PROMISE PDC202{68|69|70|71|75|76|77} support" |
706 | select BLK_DEV_IDEDMA_PCI | 706 | select BLK_DEV_IDEDMA_PCI |
707 | 707 | ||
708 | config BLK_DEV_SVWKS | 708 | config BLK_DEV_SVWKS |
709 | tristate "ServerWorks OSB4/CSB5/CSB6 chipsets support" | 709 | tristate "ServerWorks OSB4/CSB5/CSB6 chipsets support" |
710 | select BLK_DEV_IDEDMA_PCI | 710 | select BLK_DEV_IDEDMA_PCI |
711 | help | 711 | help |
712 | This driver adds PIO/(U)DMA support for the ServerWorks OSB4/CSB5 | 712 | This driver adds PIO/(U)DMA support for the ServerWorks OSB4/CSB5 |
713 | chipsets. | 713 | chipsets. |
714 | 714 | ||
715 | config BLK_DEV_SGIIOC4 | 715 | config BLK_DEV_SGIIOC4 |
716 | tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support" | 716 | tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support" |
717 | depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4 | 717 | depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4 |
718 | select BLK_DEV_IDEDMA_PCI | 718 | select BLK_DEV_IDEDMA_PCI |
719 | help | 719 | help |
720 | This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4 | 720 | This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4 |
721 | chipset, which has one channel and can support two devices. | 721 | chipset, which has one channel and can support two devices. |
722 | Please say Y here if you have an Altix System from SGI. | 722 | Please say Y here if you have an Altix System from SGI. |
723 | 723 | ||
724 | config BLK_DEV_SIIMAGE | 724 | config BLK_DEV_SIIMAGE |
725 | tristate "Silicon Image chipset support" | 725 | tristate "Silicon Image chipset support" |
726 | select BLK_DEV_IDEDMA_PCI | 726 | select BLK_DEV_IDEDMA_PCI |
727 | help | 727 | help |
728 | This driver adds PIO/(U)DMA support for the SI CMD680 and SII | 728 | This driver adds PIO/(U)DMA support for the SI CMD680 and SII |
729 | 3112 (Serial ATA) chips. | 729 | 3112 (Serial ATA) chips. |
730 | 730 | ||
731 | config BLK_DEV_SIS5513 | 731 | config BLK_DEV_SIS5513 |
732 | tristate "SiS5513 chipset support" | 732 | tristate "SiS5513 chipset support" |
733 | depends on X86 | 733 | depends on X86 |
734 | select BLK_DEV_IDEDMA_PCI | 734 | select BLK_DEV_IDEDMA_PCI |
735 | help | 735 | help |
736 | This driver ensures (U)DMA support for SIS5513 chipset family based | 736 | This driver ensures (U)DMA support for SIS5513 chipset family based |
737 | mainboards. | 737 | mainboards. |
738 | 738 | ||
739 | The following chipsets are supported: | 739 | The following chipsets are supported: |
740 | ATA16: SiS5511, SiS5513 | 740 | ATA16: SiS5511, SiS5513 |
741 | ATA33: SiS5591, SiS5597, SiS5598, SiS5600 | 741 | ATA33: SiS5591, SiS5597, SiS5598, SiS5600 |
742 | ATA66: SiS530, SiS540, SiS620, SiS630, SiS640 | 742 | ATA66: SiS530, SiS540, SiS620, SiS630, SiS640 |
743 | ATA100: SiS635, SiS645, SiS650, SiS730, SiS735, SiS740, | 743 | ATA100: SiS635, SiS645, SiS650, SiS730, SiS735, SiS740, |
744 | SiS745, SiS750 | 744 | SiS745, SiS750 |
745 | 745 | ||
746 | If you say Y here, you need to say Y to "Use DMA by default when | 746 | If you say Y here, you need to say Y to "Use DMA by default when |
747 | available" as well. | 747 | available" as well. |
748 | 748 | ||
749 | Please read the comments at the top of <file:drivers/ide/pci/sis5513.c>. | 749 | Please read the comments at the top of <file:drivers/ide/pci/sis5513.c>. |
750 | 750 | ||
751 | config BLK_DEV_SL82C105 | 751 | config BLK_DEV_SL82C105 |
752 | tristate "Winbond SL82c105 support" | 752 | tristate "Winbond SL82c105 support" |
753 | depends on (PPC || ARM) | 753 | depends on (PPC || ARM) |
754 | select BLK_DEV_IDEDMA_PCI | 754 | select BLK_DEV_IDEDMA_PCI |
755 | help | 755 | help |
756 | If you have a Winbond SL82c105 IDE controller, say Y here to enable | 756 | If you have a Winbond SL82c105 IDE controller, say Y here to enable |
757 | special configuration for this chip. This is common on various CHRP | 757 | special configuration for this chip. This is common on various CHRP |
758 | motherboards, but could be used elsewhere. If in doubt, say Y. | 758 | motherboards, but could be used elsewhere. If in doubt, say Y. |
759 | 759 | ||
760 | config BLK_DEV_SLC90E66 | 760 | config BLK_DEV_SLC90E66 |
761 | tristate "SLC90E66 chipset support" | 761 | tristate "SLC90E66 chipset support" |
762 | select BLK_DEV_IDEDMA_PCI | 762 | select BLK_DEV_IDEDMA_PCI |
763 | help | 763 | help |
764 | This driver ensures (U)DMA support for Victory66 SouthBridges for | 764 | This driver ensures (U)DMA support for Victory66 SouthBridges for |
765 | SMsC with Intel NorthBridges. This is an Ultra66 based chipset. | 765 | SMsC with Intel NorthBridges. This is an Ultra66 based chipset. |
766 | The nice thing about it is that you can mix Ultra/DMA/PIO devices | 766 | The nice thing about it is that you can mix Ultra/DMA/PIO devices |
767 | and it will handle timing cycles. Since this is an improved | 767 | and it will handle timing cycles. Since this is an improved |
768 | look-a-like to the PIIX4 it should be a nice addition. | 768 | look-a-like to the PIIX4 it should be a nice addition. |
769 | 769 | ||
770 | If you say Y here, you need to say Y to "Use DMA by default when | 770 | If you say Y here, you need to say Y to "Use DMA by default when |
771 | available" as well. | 771 | available" as well. |
772 | 772 | ||
773 | Please read the comments at the top of | 773 | Please read the comments at the top of |
774 | <file:drivers/ide/pci/slc90e66.c>. | 774 | <file:drivers/ide/pci/slc90e66.c>. |
775 | 775 | ||
776 | config BLK_DEV_TRM290 | 776 | config BLK_DEV_TRM290 |
777 | tristate "Tekram TRM290 chipset support" | 777 | tristate "Tekram TRM290 chipset support" |
778 | select BLK_DEV_IDEDMA_PCI | 778 | select BLK_DEV_IDEDMA_PCI |
779 | help | 779 | help |
780 | This driver adds support for bus master DMA transfers | 780 | This driver adds support for bus master DMA transfers |
781 | using the Tekram TRM290 PCI IDE chip. Volunteers are | 781 | using the Tekram TRM290 PCI IDE chip. Volunteers are |
782 | needed for further tweaking and development. | 782 | needed for further tweaking and development. |
783 | Please read the comments at the top of <file:drivers/ide/pci/trm290.c>. | 783 | Please read the comments at the top of <file:drivers/ide/pci/trm290.c>. |
784 | 784 | ||
785 | config BLK_DEV_VIA82CXXX | 785 | config BLK_DEV_VIA82CXXX |
786 | tristate "VIA82CXXX chipset support" | 786 | tristate "VIA82CXXX chipset support" |
787 | select BLK_DEV_IDEDMA_PCI | 787 | select BLK_DEV_IDEDMA_PCI |
788 | help | 788 | help |
789 | This driver adds explicit support for VIA BusMastering IDE chips. | 789 | This driver adds explicit support for VIA BusMastering IDE chips. |
790 | This allows the kernel to change PIO, DMA and UDMA speeds and to | 790 | This allows the kernel to change PIO, DMA and UDMA speeds and to |
791 | configure the chip to optimum performance. | 791 | configure the chip to optimum performance. |
792 | 792 | ||
793 | config BLK_DEV_TC86C001 | 793 | config BLK_DEV_TC86C001 |
794 | tristate "Toshiba TC86C001 support" | 794 | tristate "Toshiba TC86C001 support" |
795 | select BLK_DEV_IDEDMA_PCI | 795 | select BLK_DEV_IDEDMA_PCI |
796 | help | 796 | help |
797 | This driver adds support for Toshiba TC86C001 GOKU-S chip. | 797 | This driver adds support for Toshiba TC86C001 GOKU-S chip. |
798 | 798 | ||
799 | config BLK_DEV_CELLEB | 799 | config BLK_DEV_CELLEB |
800 | tristate "Toshiba's Cell Reference Set IDE support" | 800 | tristate "Toshiba's Cell Reference Set IDE support" |
801 | depends on PPC_CELLEB | 801 | depends on PPC_CELLEB |
802 | select BLK_DEV_IDEDMA_PCI | 802 | select BLK_DEV_IDEDMA_PCI |
803 | help | 803 | help |
804 | This driver provides support for the on-board IDE controller on | 804 | This driver provides support for the on-board IDE controller on |
805 | Toshiba Cell Reference Board. | 805 | Toshiba Cell Reference Board. |
806 | If unsure, say Y. | 806 | If unsure, say Y. |
807 | 807 | ||
808 | endif | 808 | endif |
809 | 809 | ||
810 | config BLK_DEV_IDE_PMAC | 810 | config BLK_DEV_IDE_PMAC |
811 | tristate "PowerMac on-board IDE support" | 811 | tristate "PowerMac on-board IDE support" |
812 | depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y | 812 | depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y |
813 | help | 813 | help |
814 | This driver provides support for the on-board IDE controller on | 814 | This driver provides support for the on-board IDE controller on |
815 | most of the recent Apple Power Macintoshes and PowerBooks. | 815 | most of the recent Apple Power Macintoshes and PowerBooks. |
816 | If unsure, say Y. | 816 | If unsure, say Y. |
817 | 817 | ||
818 | config BLK_DEV_IDE_PMAC_ATA100FIRST | 818 | config BLK_DEV_IDE_PMAC_ATA100FIRST |
819 | bool "Probe on-board ATA/100 (Kauai) first" | 819 | bool "Probe on-board ATA/100 (Kauai) first" |
820 | depends on BLK_DEV_IDE_PMAC | 820 | depends on BLK_DEV_IDE_PMAC |
821 | help | 821 | help |
822 | This option will cause the ATA/100 controller found in UniNorth2 | 822 | This option will cause the ATA/100 controller found in UniNorth2 |
823 | based machines (Windtunnel PowerMac, Aluminium PowerBooks, ...) | 823 | based machines (Windtunnel PowerMac, Aluminium PowerBooks, ...) |
824 | to be probed before the ATA/66 and ATA/33 controllers. Without | 824 | to be probed before the ATA/66 and ATA/33 controllers. Without |
825 | these, those machine used to have the hard disk on hdc and the | 825 | these, those machine used to have the hard disk on hdc and the |
826 | CD-ROM on hda. This option changes this to more natural hda for | 826 | CD-ROM on hda. This option changes this to more natural hda for |
827 | hard disk and hdc for CD-ROM. | 827 | hard disk and hdc for CD-ROM. |
828 | 828 | ||
829 | config BLK_DEV_IDEDMA_PMAC | 829 | config BLK_DEV_IDEDMA_PMAC |
830 | bool "PowerMac IDE DMA support" | 830 | bool "PowerMac IDE DMA support" |
831 | depends on BLK_DEV_IDE_PMAC | 831 | depends on BLK_DEV_IDE_PMAC |
832 | select BLK_DEV_IDEDMA_PCI | 832 | select BLK_DEV_IDEDMA_PCI |
833 | help | 833 | help |
834 | This option allows the driver for the on-board IDE controller on | 834 | This option allows the driver for the on-board IDE controller on |
835 | Power Macintoshes and PowerBooks to use DMA (direct memory access) | 835 | Power Macintoshes and PowerBooks to use DMA (direct memory access) |
836 | to transfer data to and from memory. Saying Y is safe and improves | 836 | to transfer data to and from memory. Saying Y is safe and improves |
837 | performance. | 837 | performance. |
838 | 838 | ||
839 | config BLK_DEV_IDE_SWARM | 839 | config BLK_DEV_IDE_SWARM |
840 | tristate "IDE for Sibyte evaluation boards" | 840 | tristate "IDE for Sibyte evaluation boards" |
841 | depends on SIBYTE_SB1xxx_SOC | 841 | depends on SIBYTE_SB1xxx_SOC |
842 | 842 | ||
843 | config BLK_DEV_IDE_AU1XXX | 843 | config BLK_DEV_IDE_AU1XXX |
844 | bool "IDE for AMD Alchemy Au1200" | 844 | bool "IDE for AMD Alchemy Au1200" |
845 | depends on SOC_AU1200 | 845 | depends on SOC_AU1200 |
846 | choice | 846 | choice |
847 | prompt "IDE Mode for AMD Alchemy Au1200" | 847 | prompt "IDE Mode for AMD Alchemy Au1200" |
848 | default CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA | 848 | default CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA |
849 | depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX | 849 | depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX |
850 | 850 | ||
851 | config BLK_DEV_IDE_AU1XXX_PIO_DBDMA | 851 | config BLK_DEV_IDE_AU1XXX_PIO_DBDMA |
852 | bool "PIO+DbDMA IDE for AMD Alchemy Au1200" | 852 | bool "PIO+DbDMA IDE for AMD Alchemy Au1200" |
853 | 853 | ||
854 | config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 854 | config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
855 | bool "MDMA2+DbDMA IDE for AMD Alchemy Au1200" | 855 | bool "MDMA2+DbDMA IDE for AMD Alchemy Au1200" |
856 | depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX | 856 | depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX |
857 | endchoice | 857 | endchoice |
858 | 858 | ||
859 | config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ | 859 | config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ |
860 | int "Maximum transfer size (KB) per request (up to 128)" | 860 | int "Maximum transfer size (KB) per request (up to 128)" |
861 | default "128" | 861 | default "128" |
862 | depends on BLK_DEV_IDE_AU1XXX | 862 | depends on BLK_DEV_IDE_AU1XXX |
863 | 863 | ||
864 | config IDE_ARM | 864 | config IDE_ARM |
865 | tristate "ARM IDE support" | 865 | tristate "ARM IDE support" |
866 | depends on ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) | 866 | depends on ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) |
867 | default y | 867 | default y |
868 | 868 | ||
869 | config BLK_DEV_IDE_ICSIDE | 869 | config BLK_DEV_IDE_ICSIDE |
870 | tristate "ICS IDE interface support" | 870 | tristate "ICS IDE interface support" |
871 | depends on ARM && ARCH_ACORN | 871 | depends on ARM && ARCH_ACORN |
872 | help | 872 | help |
873 | On Acorn systems, say Y here if you wish to use the ICS IDE | 873 | On Acorn systems, say Y here if you wish to use the ICS IDE |
874 | interface card. This is not required for ICS partition support. | 874 | interface card. This is not required for ICS partition support. |
875 | If you are unsure, say N to this. | 875 | If you are unsure, say N to this. |
876 | 876 | ||
877 | config BLK_DEV_IDEDMA_ICS | 877 | config BLK_DEV_IDEDMA_ICS |
878 | bool "ICS DMA support" | 878 | bool "ICS DMA support" |
879 | depends on BLK_DEV_IDE_ICSIDE | 879 | depends on BLK_DEV_IDE_ICSIDE |
880 | help | 880 | help |
881 | Say Y here if you want to add DMA (Direct Memory Access) support to | 881 | Say Y here if you want to add DMA (Direct Memory Access) support to |
882 | the ICS IDE driver. | 882 | the ICS IDE driver. |
883 | 883 | ||
884 | config BLK_DEV_IDE_RAPIDE | 884 | config BLK_DEV_IDE_RAPIDE |
885 | tristate "RapIDE interface support" | 885 | tristate "RapIDE interface support" |
886 | depends on ARM && ARCH_ACORN | 886 | depends on ARM && ARCH_ACORN |
887 | help | 887 | help |
888 | Say Y here if you want to support the Yellowstone RapIDE controller | 888 | Say Y here if you want to support the Yellowstone RapIDE controller |
889 | manufactured for use with Acorn computers. | 889 | manufactured for use with Acorn computers. |
890 | 890 | ||
891 | config BLK_DEV_IDE_BAST | 891 | config BLK_DEV_IDE_BAST |
892 | tristate "Simtec BAST / Thorcom VR1000 IDE support" | 892 | tristate "Simtec BAST / Thorcom VR1000 IDE support" |
893 | depends on ARM && (ARCH_BAST || MACH_VR1000) | 893 | depends on ARM && (ARCH_BAST || MACH_VR1000) |
894 | help | 894 | help |
895 | Say Y here if you want to support the onboard IDE channels on the | 895 | Say Y here if you want to support the onboard IDE channels on the |
896 | Simtec BAST or the Thorcom VR1000 | 896 | Simtec BAST or the Thorcom VR1000 |
897 | 897 | ||
898 | config ETRAX_IDE | 898 | config ETRAX_IDE |
899 | tristate "ETRAX IDE support" | 899 | tristate "ETRAX IDE support" |
900 | depends on CRIS && BROKEN | 900 | depends on CRIS && BROKEN |
901 | select BLK_DEV_IDEDMA | 901 | select BLK_DEV_IDEDMA |
902 | help | 902 | help |
903 | Enables the ETRAX IDE driver. | 903 | Enables the ETRAX IDE driver. |
904 | 904 | ||
905 | You can't use parallel ports or SCSI ports at the same time. | 905 | You can't use parallel ports or SCSI ports at the same time. |
906 | 906 | ||
907 | config ETRAX_IDE_DELAY | 907 | config ETRAX_IDE_DELAY |
908 | int "Delay for drives to regain consciousness" | 908 | int "Delay for drives to regain consciousness" |
909 | depends on ETRAX_IDE && ETRAX_ARCH_V10 | 909 | depends on ETRAX_IDE && ETRAX_ARCH_V10 |
910 | default 15 | 910 | default 15 |
911 | help | 911 | help |
912 | Number of seconds to wait for IDE drives to spin up after an IDE | 912 | Number of seconds to wait for IDE drives to spin up after an IDE |
913 | reset. | 913 | reset. |
914 | 914 | ||
915 | choice | 915 | choice |
916 | prompt "IDE reset pin" | 916 | prompt "IDE reset pin" |
917 | depends on ETRAX_IDE && ETRAX_ARCH_V10 | 917 | depends on ETRAX_IDE && ETRAX_ARCH_V10 |
918 | default ETRAX_IDE_PB7_RESET | 918 | default ETRAX_IDE_PB7_RESET |
919 | 919 | ||
920 | config ETRAX_IDE_PB7_RESET | 920 | config ETRAX_IDE_PB7_RESET |
921 | bool "Port_PB_Bit_7" | 921 | bool "Port_PB_Bit_7" |
922 | help | 922 | help |
923 | IDE reset on pin 7 on port B | 923 | IDE reset on pin 7 on port B |
924 | 924 | ||
925 | config ETRAX_IDE_G27_RESET | 925 | config ETRAX_IDE_G27_RESET |
926 | bool "Port_G_Bit_27" | 926 | bool "Port_G_Bit_27" |
927 | help | 927 | help |
928 | IDE reset on pin 27 on port G | 928 | IDE reset on pin 27 on port G |
929 | 929 | ||
930 | endchoice | 930 | endchoice |
931 | 931 | ||
932 | config IDE_H8300 | 932 | config IDE_H8300 |
933 | tristate "H8300 IDE support" | 933 | tristate "H8300 IDE support" |
934 | depends on H8300 | 934 | depends on H8300 |
935 | default y | 935 | default y |
936 | help | 936 | help |
937 | Enables the H8300 IDE driver. | 937 | Enables the H8300 IDE driver. |
938 | 938 | ||
939 | config BLK_DEV_GAYLE | 939 | config BLK_DEV_GAYLE |
940 | tristate "Amiga Gayle IDE interface support" | 940 | tristate "Amiga Gayle IDE interface support" |
941 | depends on AMIGA | 941 | depends on AMIGA |
942 | help | 942 | help |
943 | This is the IDE driver for the Amiga Gayle IDE interface. It supports | 943 | This is the IDE driver for the Amiga Gayle IDE interface. It supports |
944 | both the `A1200 style' and `A4000 style' of the Gayle IDE interface, | 944 | both the `A1200 style' and `A4000 style' of the Gayle IDE interface, |
945 | This includes on-board IDE interfaces on some Amiga models (A600, | 945 | This includes on-board IDE interfaces on some Amiga models (A600, |
946 | A1200, A4000, and A4000T), and IDE interfaces on the Zorro expansion | 946 | A1200, A4000, and A4000T), and IDE interfaces on the Zorro expansion |
947 | bus (M-Tech E-Matrix 530 expansion card). | 947 | bus (M-Tech E-Matrix 530 expansion card). |
948 | Say Y if you have an Amiga with a Gayle IDE interface and want to use | 948 | Say Y if you have an Amiga with a Gayle IDE interface and want to use |
949 | IDE devices (hard disks, CD-ROM drives, etc.) that are connected to | 949 | IDE devices (hard disks, CD-ROM drives, etc.) that are connected to |
950 | it. | 950 | it. |
951 | Note that you also have to enable Zorro bus support if you want to | 951 | Note that you also have to enable Zorro bus support if you want to |
952 | use Gayle IDE interfaces on the Zorro expansion bus. | 952 | use Gayle IDE interfaces on the Zorro expansion bus. |
953 | 953 | ||
954 | config BLK_DEV_IDEDOUBLER | 954 | config BLK_DEV_IDEDOUBLER |
955 | bool "Amiga IDE Doubler support (EXPERIMENTAL)" | 955 | bool "Amiga IDE Doubler support (EXPERIMENTAL)" |
956 | depends on BLK_DEV_GAYLE && EXPERIMENTAL | 956 | depends on BLK_DEV_GAYLE && EXPERIMENTAL |
957 | ---help--- | 957 | ---help--- |
958 | This driver provides support for the so-called `IDE doublers' (made | 958 | This driver provides support for the so-called `IDE doublers' (made |
959 | by various manufacturers, e.g. Eyetech) that can be connected to | 959 | by various manufacturers, e.g. Eyetech) that can be connected to |
960 | the on-board IDE interface of some Amiga models. Using such an IDE | 960 | the on-board IDE interface of some Amiga models. Using such an IDE |
961 | doubler, you can connect up to four instead of two IDE devices to | 961 | doubler, you can connect up to four instead of two IDE devices to |
962 | the Amiga's on-board IDE interface. | 962 | the Amiga's on-board IDE interface. |
963 | 963 | ||
964 | Note that the normal Amiga Gayle IDE driver may not work correctly | 964 | Note that the normal Amiga Gayle IDE driver may not work correctly |
965 | if you have an IDE doubler and don't enable this driver! | 965 | if you have an IDE doubler and don't enable this driver! |
966 | 966 | ||
967 | Say Y if you have an IDE doubler. The driver is enabled at kernel | 967 | Say Y if you have an IDE doubler. The driver is enabled at kernel |
968 | runtime using the "ide=doubler" kernel boot parameter. | 968 | runtime using the "ide=doubler" kernel boot parameter. |
969 | 969 | ||
970 | config BLK_DEV_BUDDHA | 970 | config BLK_DEV_BUDDHA |
971 | tristate "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" | 971 | tristate "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" |
972 | depends on ZORRO && EXPERIMENTAL | 972 | depends on ZORRO && EXPERIMENTAL |
973 | help | 973 | help |
974 | This is the IDE driver for the IDE interfaces on the Buddha, Catweasel | 974 | This is the IDE driver for the IDE interfaces on the Buddha, Catweasel |
975 | and X-Surf expansion boards. It supports up to two interfaces on the | 975 | and X-Surf expansion boards. It supports up to two interfaces on the |
976 | Buddha, three on the Catweasel and two on the X-Surf. | 976 | Buddha, three on the Catweasel and two on the X-Surf. |
977 | 977 | ||
978 | Say Y if you have a Buddha or Catweasel expansion board and want to | 978 | Say Y if you have a Buddha or Catweasel expansion board and want to |
979 | use IDE devices (hard disks, CD-ROM drives, etc.) that are connected | 979 | use IDE devices (hard disks, CD-ROM drives, etc.) that are connected |
980 | to one of its IDE interfaces. | 980 | to one of its IDE interfaces. |
981 | 981 | ||
982 | config BLK_DEV_FALCON_IDE | 982 | config BLK_DEV_FALCON_IDE |
983 | tristate "Falcon IDE interface support" | 983 | tristate "Falcon IDE interface support" |
984 | depends on ATARI | 984 | depends on ATARI |
985 | help | 985 | help |
986 | This is the IDE driver for the on-board IDE interface on the Atari | 986 | This is the IDE driver for the on-board IDE interface on the Atari |
987 | Falcon. Say Y if you have a Falcon and want to use IDE devices (hard | 987 | Falcon. Say Y if you have a Falcon and want to use IDE devices (hard |
988 | disks, CD-ROM drives, etc.) that are connected to the on-board IDE | 988 | disks, CD-ROM drives, etc.) that are connected to the on-board IDE |
989 | interface. | 989 | interface. |
990 | 990 | ||
991 | config BLK_DEV_MAC_IDE | 991 | config BLK_DEV_MAC_IDE |
992 | tristate "Macintosh Quadra/Powerbook IDE interface support" | 992 | tristate "Macintosh Quadra/Powerbook IDE interface support" |
993 | depends on MAC | 993 | depends on MAC |
994 | help | 994 | help |
995 | This is the IDE driver for the on-board IDE interface on some m68k | 995 | This is the IDE driver for the on-board IDE interface on some m68k |
996 | Macintosh models. It supports both the `Quadra style' (used in | 996 | Macintosh models. It supports both the `Quadra style' (used in |
997 | Quadra/ Centris 630 and Performa 588 models) and `Powerbook style' | 997 | Quadra/ Centris 630 and Performa 588 models) and `Powerbook style' |
998 | (used in the Powerbook 150 and 190 models) IDE interface. | 998 | (used in the Powerbook 150 and 190 models) IDE interface. |
999 | 999 | ||
1000 | Say Y if you have such an Macintosh model and want to use IDE | 1000 | Say Y if you have such an Macintosh model and want to use IDE |
1001 | devices (hard disks, CD-ROM drives, etc.) that are connected to the | 1001 | devices (hard disks, CD-ROM drives, etc.) that are connected to the |
1002 | on-board IDE interface. | 1002 | on-board IDE interface. |
1003 | 1003 | ||
1004 | config BLK_DEV_Q40IDE | 1004 | config BLK_DEV_Q40IDE |
1005 | tristate "Q40/Q60 IDE interface support" | 1005 | tristate "Q40/Q60 IDE interface support" |
1006 | depends on Q40 | 1006 | depends on Q40 |
1007 | help | 1007 | help |
1008 | Enable the on-board IDE controller in the Q40/Q60. This should | 1008 | Enable the on-board IDE controller in the Q40/Q60. This should |
1009 | normally be on; disable it only if you are running a custom hard | 1009 | normally be on; disable it only if you are running a custom hard |
1010 | drive subsystem through an expansion card. | 1010 | drive subsystem through an expansion card. |
1011 | 1011 | ||
1012 | config BLK_DEV_PALMCHIP_BK3710 | ||
1013 | tristate "Palmchip bk3710 IDE controller support" | ||
1014 | depends on ARCH_DAVINCI | ||
1015 | select BLK_DEV_IDEDMA_PCI | ||
1016 | help | ||
1017 | Say Y here if you want to support the onchip IDE controller on the | ||
1018 | TI DaVinci SoC | ||
1019 | |||
1020 | |||
1012 | config BLK_DEV_MPC8xx_IDE | 1021 | config BLK_DEV_MPC8xx_IDE |
1013 | tristate "MPC8xx IDE support" | 1022 | tristate "MPC8xx IDE support" |
1014 | depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE | 1023 | depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE |
1015 | help | 1024 | help |
1016 | This option provides support for IDE on Motorola MPC8xx Systems. | 1025 | This option provides support for IDE on Motorola MPC8xx Systems. |
1017 | Please see 'Type of MPC8xx IDE interface' for details. | 1026 | Please see 'Type of MPC8xx IDE interface' for details. |
1018 | 1027 | ||
1019 | If unsure, say N. | 1028 | If unsure, say N. |
1020 | 1029 | ||
1021 | choice | 1030 | choice |
1022 | prompt "Type of MPC8xx IDE interface" | 1031 | prompt "Type of MPC8xx IDE interface" |
1023 | depends on BLK_DEV_MPC8xx_IDE | 1032 | depends on BLK_DEV_MPC8xx_IDE |
1024 | default IDE_8xx_PCCARD | 1033 | default IDE_8xx_PCCARD |
1025 | 1034 | ||
1026 | config IDE_8xx_PCCARD | 1035 | config IDE_8xx_PCCARD |
1027 | bool "8xx_PCCARD" | 1036 | bool "8xx_PCCARD" |
1028 | ---help--- | 1037 | ---help--- |
1029 | Select how the IDE devices are connected to the MPC8xx system: | 1038 | Select how the IDE devices are connected to the MPC8xx system: |
1030 | 1039 | ||
1031 | 8xx_PCCARD uses the 8xx internal PCMCIA interface in combination | 1040 | 8xx_PCCARD uses the 8xx internal PCMCIA interface in combination |
1032 | with a PC Card (e.g. ARGOSY portable Hard Disk Adapter), | 1041 | with a PC Card (e.g. ARGOSY portable Hard Disk Adapter), |
1033 | ATA PC Card HDDs or ATA PC Flash Cards (example: TQM8xxL | 1042 | ATA PC Card HDDs or ATA PC Flash Cards (example: TQM8xxL |
1034 | systems) | 1043 | systems) |
1035 | 1044 | ||
1036 | 8xx_DIRECT is used for directly connected IDE devices using the 8xx | 1045 | 8xx_DIRECT is used for directly connected IDE devices using the 8xx |
1037 | internal PCMCIA interface (example: IVMS8 systems) | 1046 | internal PCMCIA interface (example: IVMS8 systems) |
1038 | 1047 | ||
1039 | EXT_DIRECT is used for IDE devices directly connected to the 8xx | 1048 | EXT_DIRECT is used for IDE devices directly connected to the 8xx |
1040 | bus using some glue logic, but _not_ the 8xx internal | 1049 | bus using some glue logic, but _not_ the 8xx internal |
1041 | PCMCIA interface (example: IDIF860 systems) | 1050 | PCMCIA interface (example: IDIF860 systems) |
1042 | 1051 | ||
1043 | config IDE_8xx_DIRECT | 1052 | config IDE_8xx_DIRECT |
1044 | bool "8xx_DIRECT" | 1053 | bool "8xx_DIRECT" |
1045 | 1054 | ||
1046 | config IDE_EXT_DIRECT | 1055 | config IDE_EXT_DIRECT |
1047 | bool "EXT_DIRECT" | 1056 | bool "EXT_DIRECT" |
1048 | 1057 | ||
1049 | endchoice | 1058 | endchoice |
1050 | 1059 | ||
1051 | # no isa -> no vlb | 1060 | # no isa -> no vlb |
1052 | if ISA | 1061 | if ISA |
1053 | 1062 | ||
1054 | comment "Other IDE chipsets support" | 1063 | comment "Other IDE chipsets support" |
1055 | comment "Note: most of these also require special kernel boot parameters" | 1064 | comment "Note: most of these also require special kernel boot parameters" |
1056 | 1065 | ||
1057 | config BLK_DEV_4DRIVES | 1066 | config BLK_DEV_4DRIVES |
1058 | bool "Generic 4 drives/port support" | 1067 | bool "Generic 4 drives/port support" |
1059 | help | 1068 | help |
1060 | Certain older chipsets, including the Tekram 690CD, use a single set | 1069 | 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 | 1070 | 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 | 1071 | 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 | 1072 | runtime using the "ide0=four" kernel boot parameter if you say Y |
1064 | here. | 1073 | here. |
1065 | 1074 | ||
1066 | config BLK_DEV_ALI14XX | 1075 | config BLK_DEV_ALI14XX |
1067 | tristate "ALI M14xx support" | 1076 | tristate "ALI M14xx support" |
1068 | help | 1077 | help |
1069 | This driver is enabled at runtime using the "ali14xx.probe" kernel | 1078 | This driver is enabled at runtime using the "ali14xx.probe" kernel |
1070 | boot parameter. It enables support for the secondary IDE interface | 1079 | boot parameter. It enables support for the secondary IDE interface |
1071 | of the ALI M1439/1443/1445/1487/1489 chipsets, and permits faster | 1080 | of the ALI M1439/1443/1445/1487/1489 chipsets, and permits faster |
1072 | I/O speeds to be set as well. See the files | 1081 | I/O speeds to be set as well. See the files |
1073 | <file:Documentation/ide.txt> and <file:drivers/ide/legacy/ali14xx.c> | 1082 | <file:Documentation/ide.txt> and <file:drivers/ide/legacy/ali14xx.c> |
1074 | for more info. | 1083 | for more info. |
1075 | 1084 | ||
1076 | config BLK_DEV_DTC2278 | 1085 | config BLK_DEV_DTC2278 |
1077 | tristate "DTC-2278 support" | 1086 | tristate "DTC-2278 support" |
1078 | help | 1087 | help |
1079 | This driver is enabled at runtime using the "dtc2278.probe" kernel | 1088 | This driver is enabled at runtime using the "dtc2278.probe" kernel |
1080 | boot parameter. It enables support for the secondary IDE interface | 1089 | boot parameter. It enables support for the secondary IDE interface |
1081 | of the DTC-2278 card, and permits faster I/O speeds to be set as | 1090 | of the DTC-2278 card, and permits faster I/O speeds to be set as |
1082 | well. See the <file:Documentation/ide.txt> and | 1091 | well. See the <file:Documentation/ide.txt> and |
1083 | <file:drivers/ide/legacy/dtc2278.c> files for more info. | 1092 | <file:drivers/ide/legacy/dtc2278.c> files for more info. |
1084 | 1093 | ||
1085 | config BLK_DEV_HT6560B | 1094 | config BLK_DEV_HT6560B |
1086 | tristate "Holtek HT6560B support" | 1095 | tristate "Holtek HT6560B support" |
1087 | help | 1096 | help |
1088 | This driver is enabled at runtime using the "ht6560b.probe" kernel | 1097 | This driver is enabled at runtime using the "ht6560b.probe" kernel |
1089 | boot parameter. It enables support for the secondary IDE interface | 1098 | boot parameter. It enables support for the secondary IDE interface |
1090 | of the Holtek card, and permits faster I/O speeds to be set as well. | 1099 | of the Holtek card, and permits faster I/O speeds to be set as well. |
1091 | See the <file:Documentation/ide.txt> and | 1100 | See the <file:Documentation/ide.txt> and |
1092 | <file:drivers/ide/legacy/ht6560b.c> files for more info. | 1101 | <file:drivers/ide/legacy/ht6560b.c> files for more info. |
1093 | 1102 | ||
1094 | config BLK_DEV_QD65XX | 1103 | config BLK_DEV_QD65XX |
1095 | tristate "QDI QD65xx support" | 1104 | tristate "QDI QD65xx support" |
1096 | help | 1105 | help |
1097 | This driver is enabled at runtime using the "qd65xx.probe" kernel | 1106 | This driver is enabled at runtime using the "qd65xx.probe" kernel |
1098 | boot parameter. It permits faster I/O speeds to be set. See the | 1107 | boot parameter. It permits faster I/O speeds to be set. See the |
1099 | <file:Documentation/ide.txt> and <file:drivers/ide/legacy/qd65xx.c> | 1108 | <file:Documentation/ide.txt> and <file:drivers/ide/legacy/qd65xx.c> |
1100 | for more info. | 1109 | for more info. |
1101 | 1110 | ||
1102 | config BLK_DEV_UMC8672 | 1111 | config BLK_DEV_UMC8672 |
1103 | tristate "UMC-8672 support" | 1112 | tristate "UMC-8672 support" |
1104 | help | 1113 | help |
1105 | This driver is enabled at runtime using the "umc8672.probe" kernel | 1114 | This driver is enabled at runtime using the "umc8672.probe" kernel |
1106 | boot parameter. It enables support for the secondary IDE interface | 1115 | boot parameter. It enables support for the secondary IDE interface |
1107 | of the UMC-8672, and permits faster I/O speeds to be set as well. | 1116 | of the UMC-8672, and permits faster I/O speeds to be set as well. |
1108 | See the files <file:Documentation/ide.txt> and | 1117 | See the files <file:Documentation/ide.txt> and |
1109 | <file:drivers/ide/legacy/umc8672.c> for more info. | 1118 | <file:drivers/ide/legacy/umc8672.c> for more info. |
1110 | 1119 | ||
1111 | endif | 1120 | endif |
1112 | 1121 | ||
1113 | config BLK_DEV_IDEDMA | 1122 | config BLK_DEV_IDEDMA |
1114 | def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 1123 | def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
1115 | 1124 | ||
1116 | config IDE_ARCH_OBSOLETE_INIT | 1125 | config IDE_ARCH_OBSOLETE_INIT |
1117 | def_bool ALPHA || (ARM && !ARCH_L7200) || BLACKFIN || X86 || IA64 || M32R || MIPS || PARISC || PPC || (SUPERH64 && BLK_DEV_IDEPCI) || SPARC | 1126 | def_bool ALPHA || (ARM && !ARCH_L7200) || BLACKFIN || X86 || IA64 || M32R || MIPS || PARISC || PPC || (SUPERH64 && BLK_DEV_IDEPCI) || SPARC |
1118 | 1127 | ||
1119 | endif | 1128 | endif |
1120 | 1129 | ||
1121 | config BLK_DEV_HD_ONLY | 1130 | config BLK_DEV_HD_ONLY |
1122 | bool "Old hard disk (MFM/RLL/IDE) driver" | 1131 | bool "Old hard disk (MFM/RLL/IDE) driver" |
1123 | depends on BLK_DEV_IDE=n | 1132 | depends on BLK_DEV_IDE=n |
1124 | help | 1133 | help |
1125 | There are two drivers for MFM/RLL/IDE hard disks. Most people use | 1134 | There are two drivers for MFM/RLL/IDE hard disks. Most people use |
1126 | the newer enhanced driver, but this old one is still around for two | 1135 | the newer enhanced driver, but this old one is still around for two |
1127 | reasons. Some older systems have strange timing problems and seem to | 1136 | reasons. Some older systems have strange timing problems and seem to |
1128 | work only with the old driver (which itself does not work with some | 1137 | work only with the old driver (which itself does not work with some |
1129 | newer systems). The other reason is that the old driver is smaller, | 1138 | newer systems). The other reason is that the old driver is smaller, |
1130 | since it lacks the enhanced functionality of the new one. This makes | 1139 | since it lacks the enhanced functionality of the new one. This makes |
1131 | it a good choice for systems with very tight memory restrictions, or | 1140 | it a good choice for systems with very tight memory restrictions, or |
1132 | for systems with only older MFM/RLL/ESDI drives. Choosing the old | 1141 | for systems with only older MFM/RLL/ESDI drives. Choosing the old |
1133 | driver can save 13 KB or so of kernel memory. | 1142 | driver can save 13 KB or so of kernel memory. |
1134 | 1143 | ||
1135 | If you are unsure, then just choose the Enhanced IDE/MFM/RLL driver | 1144 | If you are unsure, then just choose the Enhanced IDE/MFM/RLL driver |
1136 | instead of this one. For more detailed information, read the | 1145 | instead of this one. For more detailed information, read the |
1137 | Disk-HOWTO, available from | 1146 | Disk-HOWTO, available from |
1138 | <http://www.tldp.org/docs.html#howto>. | 1147 | <http://www.tldp.org/docs.html#howto>. |
1139 | 1148 | ||
1140 | config BLK_DEV_HD | 1149 | config BLK_DEV_HD |
1141 | def_bool BLK_DEV_HD_IDE || BLK_DEV_HD_ONLY | 1150 | def_bool BLK_DEV_HD_IDE || BLK_DEV_HD_ONLY |
1142 | 1151 | ||
1143 | endif # IDE | 1152 | endif # IDE |
1144 | 1153 |
drivers/ide/arm/Makefile
1 | 1 | ||
2 | obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o | 2 | obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o |
3 | obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o | 3 | obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o |
4 | obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o | 4 | obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o |
5 | obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o | ||
5 | 6 | ||
6 | ifeq ($(CONFIG_IDE_ARM), m) | 7 | ifeq ($(CONFIG_IDE_ARM), m) |
7 | obj-m += ide_arm.o | 8 | obj-m += ide_arm.o |
8 | endif | 9 | endif |
9 | 10 | ||
10 | EXTRA_CFLAGS := -Idrivers/ide | 11 | EXTRA_CFLAGS := -Idrivers/ide |
11 | 12 |
drivers/ide/arm/palm_bk3710.c
File was created | 1 | /* | |
2 | * Palmchip bk3710 IDE controller | ||
3 | * | ||
4 | * Copyright (C) 2006 Texas Instruments. | ||
5 | * Copyright (C) 2007 MontaVista Software, Inc., <source@mvista.com> | ||
6 | * | ||
7 | * ---------------------------------------------------------------------------- | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | * ---------------------------------------------------------------------------- | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #include <linux/types.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/ioport.h> | ||
30 | #include <linux/hdreg.h> | ||
31 | #include <linux/ide.h> | ||
32 | #include <linux/delay.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/clk.h> | ||
35 | #include <linux/platform_device.h> | ||
36 | |||
37 | /* Offset of the primary interface registers */ | ||
38 | #define IDE_PALM_ATA_PRI_REG_OFFSET 0x1F0 | ||
39 | |||
40 | /* Primary Control Offset */ | ||
41 | #define IDE_PALM_ATA_PRI_CTL_OFFSET 0x3F6 | ||
42 | |||
43 | /* | ||
44 | * PalmChip 3710 IDE Controller UDMA timing structure Definition | ||
45 | */ | ||
46 | struct palm_bk3710_udmatiming { | ||
47 | unsigned int rptime; /* Ready to pause time */ | ||
48 | unsigned int cycletime; /* Cycle Time */ | ||
49 | }; | ||
50 | |||
51 | #define BK3710_BMICP 0x00 | ||
52 | #define BK3710_BMISP 0x02 | ||
53 | #define BK3710_BMIDTP 0x04 | ||
54 | #define BK3710_BMICS 0x08 | ||
55 | #define BK3710_BMISS 0x0A | ||
56 | #define BK3710_BMIDTS 0x0C | ||
57 | #define BK3710_IDETIMP 0x40 | ||
58 | #define BK3710_IDETIMS 0x42 | ||
59 | #define BK3710_SIDETIM 0x44 | ||
60 | #define BK3710_SLEWCTL 0x45 | ||
61 | #define BK3710_IDESTATUS 0x47 | ||
62 | #define BK3710_UDMACTL 0x48 | ||
63 | #define BK3710_UDMATIM 0x4A | ||
64 | #define BK3710_MISCCTL 0x50 | ||
65 | #define BK3710_REGSTB 0x54 | ||
66 | #define BK3710_REGRCVR 0x58 | ||
67 | #define BK3710_DATSTB 0x5C | ||
68 | #define BK3710_DATRCVR 0x60 | ||
69 | #define BK3710_DMASTB 0x64 | ||
70 | #define BK3710_DMARCVR 0x68 | ||
71 | #define BK3710_UDMASTB 0x6C | ||
72 | #define BK3710_UDMATRP 0x70 | ||
73 | #define BK3710_UDMAENV 0x74 | ||
74 | #define BK3710_IORDYTMP 0x78 | ||
75 | #define BK3710_IORDYTMS 0x7C | ||
76 | |||
77 | #include "../ide-timing.h" | ||
78 | |||
79 | static long ide_palm_clk; | ||
80 | |||
81 | static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { | ||
82 | {160, 240}, /* UDMA Mode 0 */ | ||
83 | {125, 160}, /* UDMA Mode 1 */ | ||
84 | {100, 120}, /* UDMA Mode 2 */ | ||
85 | {100, 90}, /* UDMA Mode 3 */ | ||
86 | {85, 60}, /* UDMA Mode 4 */ | ||
87 | }; | ||
88 | |||
89 | static struct clk *ideclkp; | ||
90 | |||
91 | static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, | ||
92 | unsigned int mode) | ||
93 | { | ||
94 | u8 tenv, trp, t0; | ||
95 | u32 val32; | ||
96 | u16 val16; | ||
97 | |||
98 | /* DMA Data Setup */ | ||
99 | t0 = (palm_bk3710_udmatimings[mode].cycletime + ide_palm_clk - 1) | ||
100 | / ide_palm_clk - 1; | ||
101 | tenv = (20 + ide_palm_clk - 1) / ide_palm_clk - 1; | ||
102 | trp = (palm_bk3710_udmatimings[mode].rptime + ide_palm_clk - 1) | ||
103 | / ide_palm_clk - 1; | ||
104 | |||
105 | /* udmatim Register */ | ||
106 | val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0); | ||
107 | val16 |= (mode << (dev ? 4 : 0)); | ||
108 | writew(val16, base + BK3710_UDMATIM); | ||
109 | |||
110 | /* udmastb Ultra DMA Access Strobe Width */ | ||
111 | val32 = readl(base + BK3710_UDMASTB) & (0xFF << (dev ? 0 : 8)); | ||
112 | val32 |= (t0 << (dev ? 8 : 0)); | ||
113 | writel(val32, base + BK3710_UDMASTB); | ||
114 | |||
115 | /* udmatrp Ultra DMA Ready to Pause Time */ | ||
116 | val32 = readl(base + BK3710_UDMATRP) & (0xFF << (dev ? 0 : 8)); | ||
117 | val32 |= (trp << (dev ? 8 : 0)); | ||
118 | writel(val32, base + BK3710_UDMATRP); | ||
119 | |||
120 | /* udmaenv Ultra DMA envelop Time */ | ||
121 | val32 = readl(base + BK3710_UDMAENV) & (0xFF << (dev ? 0 : 8)); | ||
122 | val32 |= (tenv << (dev ? 8 : 0)); | ||
123 | writel(val32, base + BK3710_UDMAENV); | ||
124 | |||
125 | /* Enable UDMA for Device */ | ||
126 | val16 = readw(base + BK3710_UDMACTL) | (1 << dev); | ||
127 | writew(val16, base + BK3710_UDMACTL); | ||
128 | } | ||
129 | |||
130 | static void palm_bk3710_setdmamode(void __iomem *base, unsigned int dev, | ||
131 | unsigned short min_cycle, | ||
132 | unsigned int mode) | ||
133 | { | ||
134 | u8 td, tkw, t0; | ||
135 | u32 val32; | ||
136 | u16 val16; | ||
137 | struct ide_timing *t; | ||
138 | int cycletime; | ||
139 | |||
140 | t = ide_timing_find_mode(mode); | ||
141 | cycletime = max_t(int, t->cycle, min_cycle); | ||
142 | |||
143 | /* DMA Data Setup */ | ||
144 | t0 = (cycletime + ide_palm_clk - 1) / ide_palm_clk; | ||
145 | td = (t->active + ide_palm_clk - 1) / ide_palm_clk; | ||
146 | tkw = t0 - td - 1; | ||
147 | td -= 1; | ||
148 | |||
149 | val32 = readl(base + BK3710_DMASTB) & (0xFF << (dev ? 0 : 8)); | ||
150 | val32 |= (td << (dev ? 8 : 0)); | ||
151 | writel(val32, base + BK3710_DMASTB); | ||
152 | |||
153 | val32 = readl(base + BK3710_DMARCVR) & (0xFF << (dev ? 0 : 8)); | ||
154 | val32 |= (tkw << (dev ? 8 : 0)); | ||
155 | writel(val32, base + BK3710_DMARCVR); | ||
156 | |||
157 | /* Disable UDMA for Device */ | ||
158 | val16 = readw(base + BK3710_UDMACTL) & ~(1 << dev); | ||
159 | writew(val16, base + BK3710_UDMACTL); | ||
160 | } | ||
161 | |||
162 | static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, | ||
163 | unsigned int dev, unsigned int cycletime, | ||
164 | unsigned int mode) | ||
165 | { | ||
166 | u8 t2, t2i, t0; | ||
167 | u32 val32; | ||
168 | struct ide_timing *t; | ||
169 | |||
170 | /* PIO Data Setup */ | ||
171 | t0 = (cycletime + ide_palm_clk - 1) / ide_palm_clk; | ||
172 | t2 = (ide_timing_find_mode(XFER_PIO_0 + mode)->active + | ||
173 | ide_palm_clk - 1) / ide_palm_clk; | ||
174 | |||
175 | t2i = t0 - t2 - 1; | ||
176 | t2 -= 1; | ||
177 | |||
178 | val32 = readl(base + BK3710_DATSTB) & (0xFF << (dev ? 0 : 8)); | ||
179 | val32 |= (t2 << (dev ? 8 : 0)); | ||
180 | writel(val32, base + BK3710_DATSTB); | ||
181 | |||
182 | val32 = readl(base + BK3710_DATRCVR) & (0xFF << (dev ? 0 : 8)); | ||
183 | val32 |= (t2i << (dev ? 8 : 0)); | ||
184 | writel(val32, base + BK3710_DATRCVR); | ||
185 | |||
186 | if (mate && mate->present) { | ||
187 | u8 mode2 = ide_get_best_pio_mode(mate, 255, 4); | ||
188 | |||
189 | if (mode2 < mode) | ||
190 | mode = mode2; | ||
191 | } | ||
192 | |||
193 | /* TASKFILE Setup */ | ||
194 | t = ide_timing_find_mode(XFER_PIO_0 + mode); | ||
195 | t0 = (t->cyc8b + ide_palm_clk - 1) / ide_palm_clk; | ||
196 | t2 = (t->act8b + ide_palm_clk - 1) / ide_palm_clk; | ||
197 | |||
198 | t2i = t0 - t2 - 1; | ||
199 | t2 -= 1; | ||
200 | |||
201 | val32 = readl(base + BK3710_REGSTB) & (0xFF << (dev ? 0 : 8)); | ||
202 | val32 |= (t2 << (dev ? 8 : 0)); | ||
203 | writel(val32, base + BK3710_REGSTB); | ||
204 | |||
205 | val32 = readl(base + BK3710_REGRCVR) & (0xFF << (dev ? 0 : 8)); | ||
206 | val32 |= (t2i << (dev ? 8 : 0)); | ||
207 | writel(val32, base + BK3710_REGRCVR); | ||
208 | } | ||
209 | |||
210 | static void palm_bk3710_set_dma_mode(ide_drive_t *drive, u8 xferspeed) | ||
211 | { | ||
212 | int is_slave = drive->dn & 1; | ||
213 | void __iomem *base = (void *)drive->hwif->dma_base; | ||
214 | |||
215 | if (xferspeed >= XFER_UDMA_0) { | ||
216 | palm_bk3710_setudmamode(base, is_slave, | ||
217 | xferspeed - XFER_UDMA_0); | ||
218 | } else { | ||
219 | palm_bk3710_setdmamode(base, is_slave, drive->id->eide_dma_min, | ||
220 | xferspeed); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | static void palm_bk3710_set_pio_mode(ide_drive_t *drive, u8 pio) | ||
225 | { | ||
226 | unsigned int cycle_time; | ||
227 | int is_slave = drive->dn & 1; | ||
228 | ide_drive_t *mate; | ||
229 | void __iomem *base = (void *)drive->hwif->dma_base; | ||
230 | |||
231 | /* | ||
232 | * Obtain the drive PIO data for tuning the Palm Chip registers | ||
233 | */ | ||
234 | cycle_time = ide_pio_cycle_time(drive, pio); | ||
235 | mate = ide_get_paired_drive(drive); | ||
236 | palm_bk3710_setpiomode(base, mate, is_slave, cycle_time, pio); | ||
237 | } | ||
238 | |||
239 | static void __devinit palm_bk3710_chipinit(void __iomem *base) | ||
240 | { | ||
241 | /* | ||
242 | * enable the reset_en of ATA controller so that when ata signals | ||
243 | * are brought out, by writing into device config. at that | ||
244 | * time por_n signal should not be 'Z' and have a stable value. | ||
245 | */ | ||
246 | writel(0x0300, base + BK3710_MISCCTL); | ||
247 | |||
248 | /* wait for some time and deassert the reset of ATA Device. */ | ||
249 | mdelay(100); | ||
250 | |||
251 | /* Deassert the Reset */ | ||
252 | writel(0x0200, base + BK3710_MISCCTL); | ||
253 | |||
254 | /* | ||
255 | * Program the IDETIMP Register Value based on the following assumptions | ||
256 | * | ||
257 | * (ATA_IDETIMP_IDEEN , ENABLE ) | | ||
258 | * (ATA_IDETIMP_SLVTIMEN , DISABLE) | | ||
259 | * (ATA_IDETIMP_RDYSMPL , 70NS) | | ||
260 | * (ATA_IDETIMP_RDYRCVRY , 50NS) | | ||
261 | * (ATA_IDETIMP_DMAFTIM1 , PIOCOMP) | | ||
262 | * (ATA_IDETIMP_PREPOST1 , DISABLE) | | ||
263 | * (ATA_IDETIMP_RDYSEN1 , DISABLE) | | ||
264 | * (ATA_IDETIMP_PIOFTIM1 , DISABLE) | | ||
265 | * (ATA_IDETIMP_DMAFTIM0 , PIOCOMP) | | ||
266 | * (ATA_IDETIMP_PREPOST0 , DISABLE) | | ||
267 | * (ATA_IDETIMP_RDYSEN0 , DISABLE) | | ||
268 | * (ATA_IDETIMP_PIOFTIM0 , DISABLE) | ||
269 | */ | ||
270 | writew(0xB388, base + BK3710_IDETIMP); | ||
271 | |||
272 | /* | ||
273 | * Configure SIDETIM Register | ||
274 | * (ATA_SIDETIM_RDYSMPS1 ,120NS ) | | ||
275 | * (ATA_SIDETIM_RDYRCYS1 ,120NS ) | ||
276 | */ | ||
277 | writeb(0, base + BK3710_SIDETIM); | ||
278 | |||
279 | /* | ||
280 | * UDMACTL Ultra-ATA DMA Control | ||
281 | * (ATA_UDMACTL_UDMAP1 , 0 ) | | ||
282 | * (ATA_UDMACTL_UDMAP0 , 0 ) | ||
283 | * | ||
284 | */ | ||
285 | writew(0, base + BK3710_UDMACTL); | ||
286 | |||
287 | /* | ||
288 | * MISCCTL Miscellaneous Conrol Register | ||
289 | * (ATA_MISCCTL_RSTMODEP , 1) | | ||
290 | * (ATA_MISCCTL_RESETP , 0) | | ||
291 | * (ATA_MISCCTL_TIMORIDE , 1) | ||
292 | */ | ||
293 | writel(0x201, base + BK3710_MISCCTL); | ||
294 | |||
295 | /* | ||
296 | * IORDYTMP IORDY Timer for Primary Register | ||
297 | * (ATA_IORDYTMP_IORDYTMP , 0xffff ) | ||
298 | */ | ||
299 | writel(0xFFFF, base + BK3710_IORDYTMP); | ||
300 | |||
301 | /* | ||
302 | * Configure BMISP Register | ||
303 | * (ATA_BMISP_DMAEN1 , DISABLE ) | | ||
304 | * (ATA_BMISP_DMAEN0 , DISABLE ) | | ||
305 | * (ATA_BMISP_IORDYINT , CLEAR) | | ||
306 | * (ATA_BMISP_INTRSTAT , CLEAR) | | ||
307 | * (ATA_BMISP_DMAERROR , CLEAR) | ||
308 | */ | ||
309 | writew(0, base + BK3710_BMISP); | ||
310 | |||
311 | palm_bk3710_setpiomode(base, NULL, 0, 600, 0); | ||
312 | palm_bk3710_setpiomode(base, NULL, 1, 600, 0); | ||
313 | } | ||
314 | static int __devinit palm_bk3710_probe(struct platform_device *pdev) | ||
315 | { | ||
316 | hw_regs_t ide_ctlr_info; | ||
317 | int index = 0; | ||
318 | int pribase; | ||
319 | struct clk *clkp; | ||
320 | struct resource *mem, *irq; | ||
321 | ide_hwif_t *hwif; | ||
322 | void __iomem *base; | ||
323 | |||
324 | clkp = clk_get(NULL, "IDECLK"); | ||
325 | if (IS_ERR(clkp)) | ||
326 | return -ENODEV; | ||
327 | |||
328 | ideclkp = clkp; | ||
329 | clk_enable(ideclkp); | ||
330 | ide_palm_clk = clk_get_rate(ideclkp)/100000; | ||
331 | ide_palm_clk = (10000/ide_palm_clk) + 1; | ||
332 | /* Register the IDE interface with Linux ATA Interface */ | ||
333 | memset(&ide_ctlr_info, 0, sizeof(ide_ctlr_info)); | ||
334 | |||
335 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
336 | if (mem == NULL) { | ||
337 | printk(KERN_ERR "failed to get memory region resource\n"); | ||
338 | return -ENODEV; | ||
339 | } | ||
340 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
341 | if (irq == NULL) { | ||
342 | printk(KERN_ERR "failed to get IRQ resource\n"); | ||
343 | return -ENODEV; | ||
344 | } | ||
345 | |||
346 | base = (void *)mem->start; | ||
347 | |||
348 | /* Configure the Palm Chip controller */ | ||
349 | palm_bk3710_chipinit(base); | ||
350 | |||
351 | pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET; | ||
352 | for (index = 0; index < IDE_NR_PORTS - 2; index++) | ||
353 | ide_ctlr_info.io_ports[index] = pribase + index; | ||
354 | ide_ctlr_info.io_ports[IDE_CONTROL_OFFSET] = mem->start + | ||
355 | IDE_PALM_ATA_PRI_CTL_OFFSET; | ||
356 | ide_ctlr_info.irq = irq->start; | ||
357 | ide_ctlr_info.chipset = ide_palm3710; | ||
358 | |||
359 | if (ide_register_hw(&ide_ctlr_info, NULL, &hwif) < 0) { | ||
360 | printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n"); | ||
361 | return -ENODEV; | ||
362 | } | ||
363 | |||
364 | hwif->set_pio_mode = &palm_bk3710_set_pio_mode; | ||
365 | hwif->set_dma_mode = &palm_bk3710_set_dma_mode; | ||
366 | hwif->mmio = 1; | ||
367 | default_hwif_mmiops(hwif); | ||
368 | hwif->cbl = ATA_CBL_PATA80; | ||
369 | hwif->ultra_mask = 0x1f; /* Ultra DMA Mode 4 Max | ||
370 | (input clk 99MHz) */ | ||
371 | hwif->mwdma_mask = 0x7; | ||
372 | hwif->drives[0].autotune = 1; | ||
373 | hwif->drives[1].autotune = 1; | ||
374 | |||
375 | ide_setup_dma(hwif, mem->start); | ||
376 | |||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | static struct platform_driver platform_bk_driver = { | ||
381 | .driver = { | ||
382 | .name = "palm_bk3710", | ||
383 | }, | ||
384 | .probe = palm_bk3710_probe, | ||
385 | .remove = NULL, | ||
386 | }; | ||
387 | |||
388 | static int __init palm_bk3710_init(void) | ||
389 | { | ||
390 | return platform_driver_register(&platform_bk_driver); | ||
391 | } | ||
392 | |||
393 | module_init(palm_bk3710_init); | ||
394 | MODULE_LICENSE("GPL"); | ||
395 | |||
396 |
drivers/ide/ide-proc.c
1 | /* | 1 | /* |
2 | * Copyright (C) 1997-1998 Mark Lord | 2 | * Copyright (C) 1997-1998 Mark Lord |
3 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 3 | * Copyright (C) 2003 Red Hat <alan@redhat.com> |
4 | * | 4 | * |
5 | * Some code was moved here from ide.c, see it for original copyrights. | 5 | * Some code was moved here from ide.c, see it for original copyrights. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * This is the /proc/ide/ filesystem implementation. | 9 | * This is the /proc/ide/ filesystem implementation. |
10 | * | 10 | * |
11 | * Drive/Driver settings can be retrieved by reading the drive's | 11 | * Drive/Driver settings can be retrieved by reading the drive's |
12 | * "settings" files. e.g. "cat /proc/ide0/hda/settings" | 12 | * "settings" files. e.g. "cat /proc/ide0/hda/settings" |
13 | * To write a new value "val" into a specific setting "name", use: | 13 | * To write a new value "val" into a specific setting "name", use: |
14 | * echo "name:val" >/proc/ide/ide0/hda/settings | 14 | * echo "name:val" >/proc/ide/ide0/hda/settings |
15 | * | 15 | * |
16 | * Also useful, "cat /proc/ide0/hda/[identify, smart_values, | 16 | * Also useful, "cat /proc/ide0/hda/[identify, smart_values, |
17 | * smart_thresholds, capabilities]" will issue an IDENTIFY / | 17 | * smart_thresholds, capabilities]" will issue an IDENTIFY / |
18 | * PACKET_IDENTIFY / SMART_READ_VALUES / SMART_READ_THRESHOLDS / | 18 | * PACKET_IDENTIFY / SMART_READ_VALUES / SMART_READ_THRESHOLDS / |
19 | * SENSE CAPABILITIES command to /dev/hda, and then dump out the | 19 | * SENSE CAPABILITIES command to /dev/hda, and then dump out the |
20 | * returned data as 256 16-bit words. The "hdparm" utility will | 20 | * returned data as 256 16-bit words. The "hdparm" utility will |
21 | * be updated someday soon to use this mechanism. | 21 | * be updated someday soon to use this mechanism. |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | 26 | ||
27 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/proc_fs.h> | 29 | #include <linux/proc_fs.h> |
30 | #include <linux/stat.h> | 30 | #include <linux/stat.h> |
31 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
32 | #include <linux/pci.h> | 32 | #include <linux/pci.h> |
33 | #include <linux/ctype.h> | 33 | #include <linux/ctype.h> |
34 | #include <linux/hdreg.h> | 34 | #include <linux/hdreg.h> |
35 | #include <linux/ide.h> | 35 | #include <linux/ide.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | 37 | ||
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | 39 | ||
40 | static struct proc_dir_entry *proc_ide_root; | 40 | static struct proc_dir_entry *proc_ide_root; |
41 | 41 | ||
42 | static int proc_ide_read_imodel | 42 | static int proc_ide_read_imodel |
43 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 43 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
44 | { | 44 | { |
45 | ide_hwif_t *hwif = (ide_hwif_t *) data; | 45 | ide_hwif_t *hwif = (ide_hwif_t *) data; |
46 | int len; | 46 | int len; |
47 | const char *name; | 47 | const char *name; |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * Neither ide_unknown nor ide_forced should be set at this point. | 50 | * Neither ide_unknown nor ide_forced should be set at this point. |
51 | */ | 51 | */ |
52 | switch (hwif->chipset) { | 52 | switch (hwif->chipset) { |
53 | case ide_generic: name = "generic"; break; | 53 | case ide_generic: name = "generic"; break; |
54 | case ide_pci: name = "pci"; break; | 54 | case ide_pci: name = "pci"; break; |
55 | case ide_cmd640: name = "cmd640"; break; | 55 | case ide_cmd640: name = "cmd640"; break; |
56 | case ide_dtc2278: name = "dtc2278"; break; | 56 | case ide_dtc2278: name = "dtc2278"; break; |
57 | case ide_ali14xx: name = "ali14xx"; break; | 57 | case ide_ali14xx: name = "ali14xx"; break; |
58 | case ide_qd65xx: name = "qd65xx"; break; | 58 | case ide_qd65xx: name = "qd65xx"; break; |
59 | case ide_umc8672: name = "umc8672"; break; | 59 | case ide_umc8672: name = "umc8672"; break; |
60 | case ide_ht6560b: name = "ht6560b"; break; | 60 | case ide_ht6560b: name = "ht6560b"; break; |
61 | case ide_rz1000: name = "rz1000"; break; | 61 | case ide_rz1000: name = "rz1000"; break; |
62 | case ide_trm290: name = "trm290"; break; | 62 | case ide_trm290: name = "trm290"; break; |
63 | case ide_cmd646: name = "cmd646"; break; | 63 | case ide_cmd646: name = "cmd646"; break; |
64 | case ide_cy82c693: name = "cy82c693"; break; | 64 | case ide_cy82c693: name = "cy82c693"; break; |
65 | case ide_4drives: name = "4drives"; break; | 65 | case ide_4drives: name = "4drives"; break; |
66 | case ide_pmac: name = "mac-io"; break; | 66 | case ide_pmac: name = "mac-io"; break; |
67 | case ide_au1xxx: name = "au1xxx"; break; | 67 | case ide_au1xxx: name = "au1xxx"; break; |
68 | case ide_palm3710: name = "palm3710"; break; | ||
68 | case ide_etrax100: name = "etrax100"; break; | 69 | case ide_etrax100: name = "etrax100"; break; |
69 | case ide_acorn: name = "acorn"; break; | 70 | case ide_acorn: name = "acorn"; break; |
70 | default: name = "(unknown)"; break; | 71 | default: name = "(unknown)"; break; |
71 | } | 72 | } |
72 | len = sprintf(page, "%s\n", name); | 73 | len = sprintf(page, "%s\n", name); |
73 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 74 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
74 | } | 75 | } |
75 | 76 | ||
76 | static int proc_ide_read_mate | 77 | static int proc_ide_read_mate |
77 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 78 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
78 | { | 79 | { |
79 | ide_hwif_t *hwif = (ide_hwif_t *) data; | 80 | ide_hwif_t *hwif = (ide_hwif_t *) data; |
80 | int len; | 81 | int len; |
81 | 82 | ||
82 | if (hwif && hwif->mate && hwif->mate->present) | 83 | if (hwif && hwif->mate && hwif->mate->present) |
83 | len = sprintf(page, "%s\n", hwif->mate->name); | 84 | len = sprintf(page, "%s\n", hwif->mate->name); |
84 | else | 85 | else |
85 | len = sprintf(page, "(none)\n"); | 86 | len = sprintf(page, "(none)\n"); |
86 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 87 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
87 | } | 88 | } |
88 | 89 | ||
89 | static int proc_ide_read_channel | 90 | static int proc_ide_read_channel |
90 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 91 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
91 | { | 92 | { |
92 | ide_hwif_t *hwif = (ide_hwif_t *) data; | 93 | ide_hwif_t *hwif = (ide_hwif_t *) data; |
93 | int len; | 94 | int len; |
94 | 95 | ||
95 | page[0] = hwif->channel ? '1' : '0'; | 96 | page[0] = hwif->channel ? '1' : '0'; |
96 | page[1] = '\n'; | 97 | page[1] = '\n'; |
97 | len = 2; | 98 | len = 2; |
98 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 99 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
99 | } | 100 | } |
100 | 101 | ||
101 | static int proc_ide_read_identify | 102 | static int proc_ide_read_identify |
102 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 103 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
103 | { | 104 | { |
104 | ide_drive_t *drive = (ide_drive_t *)data; | 105 | ide_drive_t *drive = (ide_drive_t *)data; |
105 | int len = 0, i = 0; | 106 | int len = 0, i = 0; |
106 | int err = 0; | 107 | int err = 0; |
107 | 108 | ||
108 | len = sprintf(page, "\n"); | 109 | len = sprintf(page, "\n"); |
109 | 110 | ||
110 | if (drive) { | 111 | if (drive) { |
111 | unsigned short *val = (unsigned short *) page; | 112 | unsigned short *val = (unsigned short *) page; |
112 | 113 | ||
113 | err = taskfile_lib_get_identify(drive, page); | 114 | err = taskfile_lib_get_identify(drive, page); |
114 | if (!err) { | 115 | if (!err) { |
115 | char *out = ((char *)page) + (SECTOR_WORDS * 4); | 116 | char *out = ((char *)page) + (SECTOR_WORDS * 4); |
116 | page = out; | 117 | page = out; |
117 | do { | 118 | do { |
118 | out += sprintf(out, "%04x%c", | 119 | out += sprintf(out, "%04x%c", |
119 | le16_to_cpu(*val), (++i & 7) ? ' ' : '\n'); | 120 | le16_to_cpu(*val), (++i & 7) ? ' ' : '\n'); |
120 | val += 1; | 121 | val += 1; |
121 | } while (i < (SECTOR_WORDS * 2)); | 122 | } while (i < (SECTOR_WORDS * 2)); |
122 | len = out - page; | 123 | len = out - page; |
123 | } | 124 | } |
124 | } | 125 | } |
125 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 126 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
126 | } | 127 | } |
127 | 128 | ||
128 | /** | 129 | /** |
129 | * __ide_add_setting - add an ide setting option | 130 | * __ide_add_setting - add an ide setting option |
130 | * @drive: drive to use | 131 | * @drive: drive to use |
131 | * @name: setting name | 132 | * @name: setting name |
132 | * @rw: true if the function is read write | 133 | * @rw: true if the function is read write |
133 | * @data_type: type of data | 134 | * @data_type: type of data |
134 | * @min: range minimum | 135 | * @min: range minimum |
135 | * @max: range maximum | 136 | * @max: range maximum |
136 | * @mul_factor: multiplication scale | 137 | * @mul_factor: multiplication scale |
137 | * @div_factor: divison scale | 138 | * @div_factor: divison scale |
138 | * @data: private data field | 139 | * @data: private data field |
139 | * @set: setting | 140 | * @set: setting |
140 | * @auto_remove: setting auto removal flag | 141 | * @auto_remove: setting auto removal flag |
141 | * | 142 | * |
142 | * Removes the setting named from the device if it is present. | 143 | * Removes the setting named from the device if it is present. |
143 | * The function takes the settings_lock to protect against | 144 | * The function takes the settings_lock to protect against |
144 | * parallel changes. This function must not be called from IRQ | 145 | * parallel changes. This function must not be called from IRQ |
145 | * context. Returns 0 on success or -1 on failure. | 146 | * context. Returns 0 on success or -1 on failure. |
146 | * | 147 | * |
147 | * BUGS: This code is seriously over-engineered. There is also | 148 | * BUGS: This code is seriously over-engineered. There is also |
148 | * magic about how the driver specific features are setup. If | 149 | * magic about how the driver specific features are setup. If |
149 | * a driver is attached we assume the driver settings are auto | 150 | * a driver is attached we assume the driver settings are auto |
150 | * remove. | 151 | * remove. |
151 | */ | 152 | */ |
152 | 153 | ||
153 | static int __ide_add_setting(ide_drive_t *drive, const char *name, int rw, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set, int auto_remove) | 154 | static int __ide_add_setting(ide_drive_t *drive, const char *name, int rw, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set, int auto_remove) |
154 | { | 155 | { |
155 | ide_settings_t **p = (ide_settings_t **) &drive->settings, *setting = NULL; | 156 | ide_settings_t **p = (ide_settings_t **) &drive->settings, *setting = NULL; |
156 | 157 | ||
157 | mutex_lock(&ide_setting_mtx); | 158 | mutex_lock(&ide_setting_mtx); |
158 | while ((*p) && strcmp((*p)->name, name) < 0) | 159 | while ((*p) && strcmp((*p)->name, name) < 0) |
159 | p = &((*p)->next); | 160 | p = &((*p)->next); |
160 | if ((setting = kzalloc(sizeof(*setting), GFP_KERNEL)) == NULL) | 161 | if ((setting = kzalloc(sizeof(*setting), GFP_KERNEL)) == NULL) |
161 | goto abort; | 162 | goto abort; |
162 | if ((setting->name = kmalloc(strlen(name) + 1, GFP_KERNEL)) == NULL) | 163 | if ((setting->name = kmalloc(strlen(name) + 1, GFP_KERNEL)) == NULL) |
163 | goto abort; | 164 | goto abort; |
164 | strcpy(setting->name, name); | 165 | strcpy(setting->name, name); |
165 | setting->rw = rw; | 166 | setting->rw = rw; |
166 | setting->data_type = data_type; | 167 | setting->data_type = data_type; |
167 | setting->min = min; | 168 | setting->min = min; |
168 | setting->max = max; | 169 | setting->max = max; |
169 | setting->mul_factor = mul_factor; | 170 | setting->mul_factor = mul_factor; |
170 | setting->div_factor = div_factor; | 171 | setting->div_factor = div_factor; |
171 | setting->data = data; | 172 | setting->data = data; |
172 | setting->set = set; | 173 | setting->set = set; |
173 | 174 | ||
174 | setting->next = *p; | 175 | setting->next = *p; |
175 | if (auto_remove) | 176 | if (auto_remove) |
176 | setting->auto_remove = 1; | 177 | setting->auto_remove = 1; |
177 | *p = setting; | 178 | *p = setting; |
178 | mutex_unlock(&ide_setting_mtx); | 179 | mutex_unlock(&ide_setting_mtx); |
179 | return 0; | 180 | return 0; |
180 | abort: | 181 | abort: |
181 | mutex_unlock(&ide_setting_mtx); | 182 | mutex_unlock(&ide_setting_mtx); |
182 | kfree(setting); | 183 | kfree(setting); |
183 | return -1; | 184 | return -1; |
184 | } | 185 | } |
185 | 186 | ||
186 | int ide_add_setting(ide_drive_t *drive, const char *name, int rw, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set) | 187 | int ide_add_setting(ide_drive_t *drive, const char *name, int rw, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set) |
187 | { | 188 | { |
188 | return __ide_add_setting(drive, name, rw, data_type, min, max, mul_factor, div_factor, data, set, 1); | 189 | return __ide_add_setting(drive, name, rw, data_type, min, max, mul_factor, div_factor, data, set, 1); |
189 | } | 190 | } |
190 | 191 | ||
191 | EXPORT_SYMBOL(ide_add_setting); | 192 | EXPORT_SYMBOL(ide_add_setting); |
192 | 193 | ||
193 | /** | 194 | /** |
194 | * __ide_remove_setting - remove an ide setting option | 195 | * __ide_remove_setting - remove an ide setting option |
195 | * @drive: drive to use | 196 | * @drive: drive to use |
196 | * @name: setting name | 197 | * @name: setting name |
197 | * | 198 | * |
198 | * Removes the setting named from the device if it is present. | 199 | * Removes the setting named from the device if it is present. |
199 | * The caller must hold the setting semaphore. | 200 | * The caller must hold the setting semaphore. |
200 | */ | 201 | */ |
201 | 202 | ||
202 | static void __ide_remove_setting (ide_drive_t *drive, char *name) | 203 | static void __ide_remove_setting (ide_drive_t *drive, char *name) |
203 | { | 204 | { |
204 | ide_settings_t **p, *setting; | 205 | ide_settings_t **p, *setting; |
205 | 206 | ||
206 | p = (ide_settings_t **) &drive->settings; | 207 | p = (ide_settings_t **) &drive->settings; |
207 | 208 | ||
208 | while ((*p) && strcmp((*p)->name, name)) | 209 | while ((*p) && strcmp((*p)->name, name)) |
209 | p = &((*p)->next); | 210 | p = &((*p)->next); |
210 | if ((setting = (*p)) == NULL) | 211 | if ((setting = (*p)) == NULL) |
211 | return; | 212 | return; |
212 | 213 | ||
213 | (*p) = setting->next; | 214 | (*p) = setting->next; |
214 | 215 | ||
215 | kfree(setting->name); | 216 | kfree(setting->name); |
216 | kfree(setting); | 217 | kfree(setting); |
217 | } | 218 | } |
218 | 219 | ||
219 | /** | 220 | /** |
220 | * auto_remove_settings - remove driver specific settings | 221 | * auto_remove_settings - remove driver specific settings |
221 | * @drive: drive | 222 | * @drive: drive |
222 | * | 223 | * |
223 | * Automatically remove all the driver specific settings for this | 224 | * Automatically remove all the driver specific settings for this |
224 | * drive. This function may not be called from IRQ context. The | 225 | * drive. This function may not be called from IRQ context. The |
225 | * caller must hold ide_setting_mtx. | 226 | * caller must hold ide_setting_mtx. |
226 | */ | 227 | */ |
227 | 228 | ||
228 | static void auto_remove_settings (ide_drive_t *drive) | 229 | static void auto_remove_settings (ide_drive_t *drive) |
229 | { | 230 | { |
230 | ide_settings_t *setting; | 231 | ide_settings_t *setting; |
231 | repeat: | 232 | repeat: |
232 | setting = drive->settings; | 233 | setting = drive->settings; |
233 | while (setting) { | 234 | while (setting) { |
234 | if (setting->auto_remove) { | 235 | if (setting->auto_remove) { |
235 | __ide_remove_setting(drive, setting->name); | 236 | __ide_remove_setting(drive, setting->name); |
236 | goto repeat; | 237 | goto repeat; |
237 | } | 238 | } |
238 | setting = setting->next; | 239 | setting = setting->next; |
239 | } | 240 | } |
240 | } | 241 | } |
241 | 242 | ||
242 | /** | 243 | /** |
243 | * ide_find_setting_by_name - find a drive specific setting | 244 | * ide_find_setting_by_name - find a drive specific setting |
244 | * @drive: drive to scan | 245 | * @drive: drive to scan |
245 | * @name: setting name | 246 | * @name: setting name |
246 | * | 247 | * |
247 | * Scan's the device setting table for a matching entry and returns | 248 | * Scan's the device setting table for a matching entry and returns |
248 | * this or NULL if no entry is found. The caller must hold the | 249 | * this or NULL if no entry is found. The caller must hold the |
249 | * setting semaphore | 250 | * setting semaphore |
250 | */ | 251 | */ |
251 | 252 | ||
252 | static ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name) | 253 | static ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name) |
253 | { | 254 | { |
254 | ide_settings_t *setting = drive->settings; | 255 | ide_settings_t *setting = drive->settings; |
255 | 256 | ||
256 | while (setting) { | 257 | while (setting) { |
257 | if (strcmp(setting->name, name) == 0) | 258 | if (strcmp(setting->name, name) == 0) |
258 | break; | 259 | break; |
259 | setting = setting->next; | 260 | setting = setting->next; |
260 | } | 261 | } |
261 | return setting; | 262 | return setting; |
262 | } | 263 | } |
263 | 264 | ||
264 | /** | 265 | /** |
265 | * ide_read_setting - read an IDE setting | 266 | * ide_read_setting - read an IDE setting |
266 | * @drive: drive to read from | 267 | * @drive: drive to read from |
267 | * @setting: drive setting | 268 | * @setting: drive setting |
268 | * | 269 | * |
269 | * Read a drive setting and return the value. The caller | 270 | * Read a drive setting and return the value. The caller |
270 | * must hold the ide_setting_mtx when making this call. | 271 | * must hold the ide_setting_mtx when making this call. |
271 | * | 272 | * |
272 | * BUGS: the data return and error are the same return value | 273 | * BUGS: the data return and error are the same return value |
273 | * so an error -EINVAL and true return of the same value cannot | 274 | * so an error -EINVAL and true return of the same value cannot |
274 | * be told apart | 275 | * be told apart |
275 | */ | 276 | */ |
276 | 277 | ||
277 | static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting) | 278 | static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting) |
278 | { | 279 | { |
279 | int val = -EINVAL; | 280 | int val = -EINVAL; |
280 | unsigned long flags; | 281 | unsigned long flags; |
281 | 282 | ||
282 | if ((setting->rw & SETTING_READ)) { | 283 | if ((setting->rw & SETTING_READ)) { |
283 | spin_lock_irqsave(&ide_lock, flags); | 284 | spin_lock_irqsave(&ide_lock, flags); |
284 | switch(setting->data_type) { | 285 | switch(setting->data_type) { |
285 | case TYPE_BYTE: | 286 | case TYPE_BYTE: |
286 | val = *((u8 *) setting->data); | 287 | val = *((u8 *) setting->data); |
287 | break; | 288 | break; |
288 | case TYPE_SHORT: | 289 | case TYPE_SHORT: |
289 | val = *((u16 *) setting->data); | 290 | val = *((u16 *) setting->data); |
290 | break; | 291 | break; |
291 | case TYPE_INT: | 292 | case TYPE_INT: |
292 | val = *((u32 *) setting->data); | 293 | val = *((u32 *) setting->data); |
293 | break; | 294 | break; |
294 | } | 295 | } |
295 | spin_unlock_irqrestore(&ide_lock, flags); | 296 | spin_unlock_irqrestore(&ide_lock, flags); |
296 | } | 297 | } |
297 | return val; | 298 | return val; |
298 | } | 299 | } |
299 | 300 | ||
300 | /** | 301 | /** |
301 | * ide_write_setting - read an IDE setting | 302 | * ide_write_setting - read an IDE setting |
302 | * @drive: drive to read from | 303 | * @drive: drive to read from |
303 | * @setting: drive setting | 304 | * @setting: drive setting |
304 | * @val: value | 305 | * @val: value |
305 | * | 306 | * |
306 | * Write a drive setting if it is possible. The caller | 307 | * Write a drive setting if it is possible. The caller |
307 | * must hold the ide_setting_mtx when making this call. | 308 | * must hold the ide_setting_mtx when making this call. |
308 | * | 309 | * |
309 | * BUGS: the data return and error are the same return value | 310 | * BUGS: the data return and error are the same return value |
310 | * so an error -EINVAL and true return of the same value cannot | 311 | * so an error -EINVAL and true return of the same value cannot |
311 | * be told apart | 312 | * be told apart |
312 | * | 313 | * |
313 | * FIXME: This should be changed to enqueue a special request | 314 | * FIXME: This should be changed to enqueue a special request |
314 | * to the driver to change settings, and then wait on a sema for completion. | 315 | * to the driver to change settings, and then wait on a sema for completion. |
315 | * The current scheme of polling is kludgy, though safe enough. | 316 | * The current scheme of polling is kludgy, though safe enough. |
316 | */ | 317 | */ |
317 | 318 | ||
318 | static int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val) | 319 | static int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val) |
319 | { | 320 | { |
320 | if (!capable(CAP_SYS_ADMIN)) | 321 | if (!capable(CAP_SYS_ADMIN)) |
321 | return -EACCES; | 322 | return -EACCES; |
322 | if (setting->set) | 323 | if (setting->set) |
323 | return setting->set(drive, val); | 324 | return setting->set(drive, val); |
324 | if (!(setting->rw & SETTING_WRITE)) | 325 | if (!(setting->rw & SETTING_WRITE)) |
325 | return -EPERM; | 326 | return -EPERM; |
326 | if (val < setting->min || val > setting->max) | 327 | if (val < setting->min || val > setting->max) |
327 | return -EINVAL; | 328 | return -EINVAL; |
328 | if (ide_spin_wait_hwgroup(drive)) | 329 | if (ide_spin_wait_hwgroup(drive)) |
329 | return -EBUSY; | 330 | return -EBUSY; |
330 | switch (setting->data_type) { | 331 | switch (setting->data_type) { |
331 | case TYPE_BYTE: | 332 | case TYPE_BYTE: |
332 | *((u8 *) setting->data) = val; | 333 | *((u8 *) setting->data) = val; |
333 | break; | 334 | break; |
334 | case TYPE_SHORT: | 335 | case TYPE_SHORT: |
335 | *((u16 *) setting->data) = val; | 336 | *((u16 *) setting->data) = val; |
336 | break; | 337 | break; |
337 | case TYPE_INT: | 338 | case TYPE_INT: |
338 | *((u32 *) setting->data) = val; | 339 | *((u32 *) setting->data) = val; |
339 | break; | 340 | break; |
340 | } | 341 | } |
341 | spin_unlock_irq(&ide_lock); | 342 | spin_unlock_irq(&ide_lock); |
342 | return 0; | 343 | return 0; |
343 | } | 344 | } |
344 | 345 | ||
345 | static int set_xfer_rate (ide_drive_t *drive, int arg) | 346 | static int set_xfer_rate (ide_drive_t *drive, int arg) |
346 | { | 347 | { |
347 | ide_task_t task; | 348 | ide_task_t task; |
348 | int err; | 349 | int err; |
349 | 350 | ||
350 | if (arg < 0 || arg > 70) | 351 | if (arg < 0 || arg > 70) |
351 | return -EINVAL; | 352 | return -EINVAL; |
352 | 353 | ||
353 | memset(&task, 0, sizeof(task)); | 354 | memset(&task, 0, sizeof(task)); |
354 | task.tf.command = WIN_SETFEATURES; | 355 | task.tf.command = WIN_SETFEATURES; |
355 | task.tf.feature = SETFEATURES_XFER; | 356 | task.tf.feature = SETFEATURES_XFER; |
356 | task.tf.nsect = (u8)arg; | 357 | task.tf.nsect = (u8)arg; |
357 | task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | | 358 | task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | |
358 | IDE_TFLAG_IN_NSECT; | 359 | IDE_TFLAG_IN_NSECT; |
359 | 360 | ||
360 | err = ide_no_data_taskfile(drive, &task); | 361 | err = ide_no_data_taskfile(drive, &task); |
361 | 362 | ||
362 | if (!err && arg) { | 363 | if (!err && arg) { |
363 | ide_set_xfer_rate(drive, (u8) arg); | 364 | ide_set_xfer_rate(drive, (u8) arg); |
364 | ide_driveid_update(drive); | 365 | ide_driveid_update(drive); |
365 | } | 366 | } |
366 | return err; | 367 | return err; |
367 | } | 368 | } |
368 | 369 | ||
369 | /** | 370 | /** |
370 | * ide_add_generic_settings - generic ide settings | 371 | * ide_add_generic_settings - generic ide settings |
371 | * @drive: drive being configured | 372 | * @drive: drive being configured |
372 | * | 373 | * |
373 | * Add the generic parts of the system settings to the /proc files. | 374 | * Add the generic parts of the system settings to the /proc files. |
374 | * The caller must not be holding the ide_setting_mtx. | 375 | * The caller must not be holding the ide_setting_mtx. |
375 | */ | 376 | */ |
376 | 377 | ||
377 | void ide_add_generic_settings (ide_drive_t *drive) | 378 | void ide_add_generic_settings (ide_drive_t *drive) |
378 | { | 379 | { |
379 | /* | 380 | /* |
380 | * drive setting name read/write access data type min max mul_factor div_factor data pointer set function | 381 | * drive setting name read/write access data type min max mul_factor div_factor data pointer set function |
381 | */ | 382 | */ |
382 | __ide_add_setting(drive, "io_32bit", drive->no_io_32bit ? SETTING_READ : SETTING_RW, TYPE_BYTE, 0, 1 + (SUPPORT_VLB_SYNC << 1), 1, 1, &drive->io_32bit, set_io_32bit, 0); | 383 | __ide_add_setting(drive, "io_32bit", drive->no_io_32bit ? SETTING_READ : SETTING_RW, TYPE_BYTE, 0, 1 + (SUPPORT_VLB_SYNC << 1), 1, 1, &drive->io_32bit, set_io_32bit, 0); |
383 | __ide_add_setting(drive, "keepsettings", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->keep_settings, NULL, 0); | 384 | __ide_add_setting(drive, "keepsettings", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->keep_settings, NULL, 0); |
384 | __ide_add_setting(drive, "nice1", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nice1, NULL, 0); | 385 | __ide_add_setting(drive, "nice1", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nice1, NULL, 0); |
385 | __ide_add_setting(drive, "pio_mode", SETTING_WRITE, TYPE_BYTE, 0, 255, 1, 1, NULL, set_pio_mode, 0); | 386 | __ide_add_setting(drive, "pio_mode", SETTING_WRITE, TYPE_BYTE, 0, 255, 1, 1, NULL, set_pio_mode, 0); |
386 | __ide_add_setting(drive, "unmaskirq", drive->no_unmask ? SETTING_READ : SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->unmask, NULL, 0); | 387 | __ide_add_setting(drive, "unmaskirq", drive->no_unmask ? SETTING_READ : SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->unmask, NULL, 0); |
387 | __ide_add_setting(drive, "using_dma", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->using_dma, set_using_dma, 0); | 388 | __ide_add_setting(drive, "using_dma", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->using_dma, set_using_dma, 0); |
388 | __ide_add_setting(drive, "init_speed", SETTING_RW, TYPE_BYTE, 0, 70, 1, 1, &drive->init_speed, NULL, 0); | 389 | __ide_add_setting(drive, "init_speed", SETTING_RW, TYPE_BYTE, 0, 70, 1, 1, &drive->init_speed, NULL, 0); |
389 | __ide_add_setting(drive, "current_speed", SETTING_RW, TYPE_BYTE, 0, 70, 1, 1, &drive->current_speed, set_xfer_rate, 0); | 390 | __ide_add_setting(drive, "current_speed", SETTING_RW, TYPE_BYTE, 0, 70, 1, 1, &drive->current_speed, set_xfer_rate, 0); |
390 | __ide_add_setting(drive, "number", SETTING_RW, TYPE_BYTE, 0, 3, 1, 1, &drive->dn, NULL, 0); | 391 | __ide_add_setting(drive, "number", SETTING_RW, TYPE_BYTE, 0, 3, 1, 1, &drive->dn, NULL, 0); |
391 | } | 392 | } |
392 | 393 | ||
393 | static void proc_ide_settings_warn(void) | 394 | static void proc_ide_settings_warn(void) |
394 | { | 395 | { |
395 | static int warned = 0; | 396 | static int warned = 0; |
396 | 397 | ||
397 | if (warned) | 398 | if (warned) |
398 | return; | 399 | return; |
399 | 400 | ||
400 | printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is " | 401 | printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is " |
401 | "obsolete, and will be removed soon!\n"); | 402 | "obsolete, and will be removed soon!\n"); |
402 | warned = 1; | 403 | warned = 1; |
403 | } | 404 | } |
404 | 405 | ||
405 | static int proc_ide_read_settings | 406 | static int proc_ide_read_settings |
406 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 407 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
407 | { | 408 | { |
408 | ide_drive_t *drive = (ide_drive_t *) data; | 409 | ide_drive_t *drive = (ide_drive_t *) data; |
409 | ide_settings_t *setting = (ide_settings_t *) drive->settings; | 410 | ide_settings_t *setting = (ide_settings_t *) drive->settings; |
410 | char *out = page; | 411 | char *out = page; |
411 | int len, rc, mul_factor, div_factor; | 412 | int len, rc, mul_factor, div_factor; |
412 | 413 | ||
413 | proc_ide_settings_warn(); | 414 | proc_ide_settings_warn(); |
414 | 415 | ||
415 | mutex_lock(&ide_setting_mtx); | 416 | mutex_lock(&ide_setting_mtx); |
416 | out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n"); | 417 | out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n"); |
417 | out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n"); | 418 | out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n"); |
418 | while(setting) { | 419 | while(setting) { |
419 | mul_factor = setting->mul_factor; | 420 | mul_factor = setting->mul_factor; |
420 | div_factor = setting->div_factor; | 421 | div_factor = setting->div_factor; |
421 | out += sprintf(out, "%-24s", setting->name); | 422 | out += sprintf(out, "%-24s", setting->name); |
422 | if ((rc = ide_read_setting(drive, setting)) >= 0) | 423 | if ((rc = ide_read_setting(drive, setting)) >= 0) |
423 | out += sprintf(out, "%-16d", rc * mul_factor / div_factor); | 424 | out += sprintf(out, "%-16d", rc * mul_factor / div_factor); |
424 | else | 425 | else |
425 | out += sprintf(out, "%-16s", "write-only"); | 426 | out += sprintf(out, "%-16s", "write-only"); |
426 | out += sprintf(out, "%-16d%-16d", (setting->min * mul_factor + div_factor - 1) / div_factor, setting->max * mul_factor / div_factor); | 427 | out += sprintf(out, "%-16d%-16d", (setting->min * mul_factor + div_factor - 1) / div_factor, setting->max * mul_factor / div_factor); |
427 | if (setting->rw & SETTING_READ) | 428 | if (setting->rw & SETTING_READ) |
428 | out += sprintf(out, "r"); | 429 | out += sprintf(out, "r"); |
429 | if (setting->rw & SETTING_WRITE) | 430 | if (setting->rw & SETTING_WRITE) |
430 | out += sprintf(out, "w"); | 431 | out += sprintf(out, "w"); |
431 | out += sprintf(out, "\n"); | 432 | out += sprintf(out, "\n"); |
432 | setting = setting->next; | 433 | setting = setting->next; |
433 | } | 434 | } |
434 | len = out - page; | 435 | len = out - page; |
435 | mutex_unlock(&ide_setting_mtx); | 436 | mutex_unlock(&ide_setting_mtx); |
436 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 437 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
437 | } | 438 | } |
438 | 439 | ||
439 | #define MAX_LEN 30 | 440 | #define MAX_LEN 30 |
440 | 441 | ||
441 | static int proc_ide_write_settings(struct file *file, const char __user *buffer, | 442 | static int proc_ide_write_settings(struct file *file, const char __user *buffer, |
442 | unsigned long count, void *data) | 443 | unsigned long count, void *data) |
443 | { | 444 | { |
444 | ide_drive_t *drive = (ide_drive_t *) data; | 445 | ide_drive_t *drive = (ide_drive_t *) data; |
445 | char name[MAX_LEN + 1]; | 446 | char name[MAX_LEN + 1]; |
446 | int for_real = 0; | 447 | int for_real = 0; |
447 | unsigned long n; | 448 | unsigned long n; |
448 | ide_settings_t *setting; | 449 | ide_settings_t *setting; |
449 | char *buf, *s; | 450 | char *buf, *s; |
450 | 451 | ||
451 | if (!capable(CAP_SYS_ADMIN)) | 452 | if (!capable(CAP_SYS_ADMIN)) |
452 | return -EACCES; | 453 | return -EACCES; |
453 | 454 | ||
454 | proc_ide_settings_warn(); | 455 | proc_ide_settings_warn(); |
455 | 456 | ||
456 | if (count >= PAGE_SIZE) | 457 | if (count >= PAGE_SIZE) |
457 | return -EINVAL; | 458 | return -EINVAL; |
458 | 459 | ||
459 | s = buf = (char *)__get_free_page(GFP_USER); | 460 | s = buf = (char *)__get_free_page(GFP_USER); |
460 | if (!buf) | 461 | if (!buf) |
461 | return -ENOMEM; | 462 | return -ENOMEM; |
462 | 463 | ||
463 | if (copy_from_user(buf, buffer, count)) { | 464 | if (copy_from_user(buf, buffer, count)) { |
464 | free_page((unsigned long)buf); | 465 | free_page((unsigned long)buf); |
465 | return -EFAULT; | 466 | return -EFAULT; |
466 | } | 467 | } |
467 | 468 | ||
468 | buf[count] = '\0'; | 469 | buf[count] = '\0'; |
469 | 470 | ||
470 | /* | 471 | /* |
471 | * Skip over leading whitespace | 472 | * Skip over leading whitespace |
472 | */ | 473 | */ |
473 | while (count && isspace(*s)) { | 474 | while (count && isspace(*s)) { |
474 | --count; | 475 | --count; |
475 | ++s; | 476 | ++s; |
476 | } | 477 | } |
477 | /* | 478 | /* |
478 | * Do one full pass to verify all parameters, | 479 | * Do one full pass to verify all parameters, |
479 | * then do another to actually write the new settings. | 480 | * then do another to actually write the new settings. |
480 | */ | 481 | */ |
481 | do { | 482 | do { |
482 | char *p = s; | 483 | char *p = s; |
483 | n = count; | 484 | n = count; |
484 | while (n > 0) { | 485 | while (n > 0) { |
485 | unsigned val; | 486 | unsigned val; |
486 | char *q = p; | 487 | char *q = p; |
487 | 488 | ||
488 | while (n > 0 && *p != ':') { | 489 | while (n > 0 && *p != ':') { |
489 | --n; | 490 | --n; |
490 | p++; | 491 | p++; |
491 | } | 492 | } |
492 | if (*p != ':') | 493 | if (*p != ':') |
493 | goto parse_error; | 494 | goto parse_error; |
494 | if (p - q > MAX_LEN) | 495 | if (p - q > MAX_LEN) |
495 | goto parse_error; | 496 | goto parse_error; |
496 | memcpy(name, q, p - q); | 497 | memcpy(name, q, p - q); |
497 | name[p - q] = 0; | 498 | name[p - q] = 0; |
498 | 499 | ||
499 | if (n > 0) { | 500 | if (n > 0) { |
500 | --n; | 501 | --n; |
501 | p++; | 502 | p++; |
502 | } else | 503 | } else |
503 | goto parse_error; | 504 | goto parse_error; |
504 | 505 | ||
505 | val = simple_strtoul(p, &q, 10); | 506 | val = simple_strtoul(p, &q, 10); |
506 | n -= q - p; | 507 | n -= q - p; |
507 | p = q; | 508 | p = q; |
508 | if (n > 0 && !isspace(*p)) | 509 | if (n > 0 && !isspace(*p)) |
509 | goto parse_error; | 510 | goto parse_error; |
510 | while (n > 0 && isspace(*p)) { | 511 | while (n > 0 && isspace(*p)) { |
511 | --n; | 512 | --n; |
512 | ++p; | 513 | ++p; |
513 | } | 514 | } |
514 | 515 | ||
515 | mutex_lock(&ide_setting_mtx); | 516 | mutex_lock(&ide_setting_mtx); |
516 | setting = ide_find_setting_by_name(drive, name); | 517 | setting = ide_find_setting_by_name(drive, name); |
517 | if (!setting) | 518 | if (!setting) |
518 | { | 519 | { |
519 | mutex_unlock(&ide_setting_mtx); | 520 | mutex_unlock(&ide_setting_mtx); |
520 | goto parse_error; | 521 | goto parse_error; |
521 | } | 522 | } |
522 | if (for_real) | 523 | if (for_real) |
523 | ide_write_setting(drive, setting, val * setting->div_factor / setting->mul_factor); | 524 | ide_write_setting(drive, setting, val * setting->div_factor / setting->mul_factor); |
524 | mutex_unlock(&ide_setting_mtx); | 525 | mutex_unlock(&ide_setting_mtx); |
525 | } | 526 | } |
526 | } while (!for_real++); | 527 | } while (!for_real++); |
527 | free_page((unsigned long)buf); | 528 | free_page((unsigned long)buf); |
528 | return count; | 529 | return count; |
529 | parse_error: | 530 | parse_error: |
530 | free_page((unsigned long)buf); | 531 | free_page((unsigned long)buf); |
531 | printk("proc_ide_write_settings(): parse error\n"); | 532 | printk("proc_ide_write_settings(): parse error\n"); |
532 | return -EINVAL; | 533 | return -EINVAL; |
533 | } | 534 | } |
534 | 535 | ||
535 | int proc_ide_read_capacity | 536 | int proc_ide_read_capacity |
536 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 537 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
537 | { | 538 | { |
538 | int len = sprintf(page,"%llu\n", (long long)0x7fffffff); | 539 | int len = sprintf(page,"%llu\n", (long long)0x7fffffff); |
539 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 540 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
540 | } | 541 | } |
541 | 542 | ||
542 | EXPORT_SYMBOL_GPL(proc_ide_read_capacity); | 543 | EXPORT_SYMBOL_GPL(proc_ide_read_capacity); |
543 | 544 | ||
544 | int proc_ide_read_geometry | 545 | int proc_ide_read_geometry |
545 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 546 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
546 | { | 547 | { |
547 | ide_drive_t *drive = (ide_drive_t *) data; | 548 | ide_drive_t *drive = (ide_drive_t *) data; |
548 | char *out = page; | 549 | char *out = page; |
549 | int len; | 550 | int len; |
550 | 551 | ||
551 | out += sprintf(out,"physical %d/%d/%d\n", | 552 | out += sprintf(out,"physical %d/%d/%d\n", |
552 | drive->cyl, drive->head, drive->sect); | 553 | drive->cyl, drive->head, drive->sect); |
553 | out += sprintf(out,"logical %d/%d/%d\n", | 554 | out += sprintf(out,"logical %d/%d/%d\n", |
554 | drive->bios_cyl, drive->bios_head, drive->bios_sect); | 555 | drive->bios_cyl, drive->bios_head, drive->bios_sect); |
555 | 556 | ||
556 | len = out - page; | 557 | len = out - page; |
557 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 558 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
558 | } | 559 | } |
559 | 560 | ||
560 | EXPORT_SYMBOL(proc_ide_read_geometry); | 561 | EXPORT_SYMBOL(proc_ide_read_geometry); |
561 | 562 | ||
562 | static int proc_ide_read_dmodel | 563 | static int proc_ide_read_dmodel |
563 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 564 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
564 | { | 565 | { |
565 | ide_drive_t *drive = (ide_drive_t *) data; | 566 | ide_drive_t *drive = (ide_drive_t *) data; |
566 | struct hd_driveid *id = drive->id; | 567 | struct hd_driveid *id = drive->id; |
567 | int len; | 568 | int len; |
568 | 569 | ||
569 | len = sprintf(page, "%.40s\n", | 570 | len = sprintf(page, "%.40s\n", |
570 | (id && id->model[0]) ? (char *)id->model : "(none)"); | 571 | (id && id->model[0]) ? (char *)id->model : "(none)"); |
571 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 572 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
572 | } | 573 | } |
573 | 574 | ||
574 | static int proc_ide_read_driver | 575 | static int proc_ide_read_driver |
575 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 576 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
576 | { | 577 | { |
577 | ide_drive_t *drive = (ide_drive_t *) data; | 578 | ide_drive_t *drive = (ide_drive_t *) data; |
578 | struct device *dev = &drive->gendev; | 579 | struct device *dev = &drive->gendev; |
579 | ide_driver_t *ide_drv; | 580 | ide_driver_t *ide_drv; |
580 | int len; | 581 | int len; |
581 | 582 | ||
582 | if (dev->driver) { | 583 | if (dev->driver) { |
583 | ide_drv = container_of(dev->driver, ide_driver_t, gen_driver); | 584 | ide_drv = container_of(dev->driver, ide_driver_t, gen_driver); |
584 | len = sprintf(page, "%s version %s\n", | 585 | len = sprintf(page, "%s version %s\n", |
585 | dev->driver->name, ide_drv->version); | 586 | dev->driver->name, ide_drv->version); |
586 | } else | 587 | } else |
587 | len = sprintf(page, "ide-default version 0.9.newide\n"); | 588 | len = sprintf(page, "ide-default version 0.9.newide\n"); |
588 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 589 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
589 | } | 590 | } |
590 | 591 | ||
591 | static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) | 592 | static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) |
592 | { | 593 | { |
593 | struct device *dev = &drive->gendev; | 594 | struct device *dev = &drive->gendev; |
594 | int ret = 1; | 595 | int ret = 1; |
595 | int err; | 596 | int err; |
596 | 597 | ||
597 | device_release_driver(dev); | 598 | device_release_driver(dev); |
598 | /* FIXME: device can still be in use by previous driver */ | 599 | /* FIXME: device can still be in use by previous driver */ |
599 | strlcpy(drive->driver_req, driver, sizeof(drive->driver_req)); | 600 | strlcpy(drive->driver_req, driver, sizeof(drive->driver_req)); |
600 | err = device_attach(dev); | 601 | err = device_attach(dev); |
601 | if (err < 0) | 602 | if (err < 0) |
602 | printk(KERN_WARNING "IDE: %s: device_attach error: %d\n", | 603 | printk(KERN_WARNING "IDE: %s: device_attach error: %d\n", |
603 | __FUNCTION__, err); | 604 | __FUNCTION__, err); |
604 | drive->driver_req[0] = 0; | 605 | drive->driver_req[0] = 0; |
605 | if (dev->driver == NULL) { | 606 | if (dev->driver == NULL) { |
606 | err = device_attach(dev); | 607 | err = device_attach(dev); |
607 | if (err < 0) | 608 | if (err < 0) |
608 | printk(KERN_WARNING | 609 | printk(KERN_WARNING |
609 | "IDE: %s: device_attach(2) error: %d\n", | 610 | "IDE: %s: device_attach(2) error: %d\n", |
610 | __FUNCTION__, err); | 611 | __FUNCTION__, err); |
611 | } | 612 | } |
612 | if (dev->driver && !strcmp(dev->driver->name, driver)) | 613 | if (dev->driver && !strcmp(dev->driver->name, driver)) |
613 | ret = 0; | 614 | ret = 0; |
614 | 615 | ||
615 | return ret; | 616 | return ret; |
616 | } | 617 | } |
617 | 618 | ||
618 | static int proc_ide_write_driver | 619 | static int proc_ide_write_driver |
619 | (struct file *file, const char __user *buffer, unsigned long count, void *data) | 620 | (struct file *file, const char __user *buffer, unsigned long count, void *data) |
620 | { | 621 | { |
621 | ide_drive_t *drive = (ide_drive_t *) data; | 622 | ide_drive_t *drive = (ide_drive_t *) data; |
622 | char name[32]; | 623 | char name[32]; |
623 | 624 | ||
624 | if (!capable(CAP_SYS_ADMIN)) | 625 | if (!capable(CAP_SYS_ADMIN)) |
625 | return -EACCES; | 626 | return -EACCES; |
626 | if (count > 31) | 627 | if (count > 31) |
627 | count = 31; | 628 | count = 31; |
628 | if (copy_from_user(name, buffer, count)) | 629 | if (copy_from_user(name, buffer, count)) |
629 | return -EFAULT; | 630 | return -EFAULT; |
630 | name[count] = '\0'; | 631 | name[count] = '\0'; |
631 | if (ide_replace_subdriver(drive, name)) | 632 | if (ide_replace_subdriver(drive, name)) |
632 | return -EINVAL; | 633 | return -EINVAL; |
633 | return count; | 634 | return count; |
634 | } | 635 | } |
635 | 636 | ||
636 | static int proc_ide_read_media | 637 | static int proc_ide_read_media |
637 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 638 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
638 | { | 639 | { |
639 | ide_drive_t *drive = (ide_drive_t *) data; | 640 | ide_drive_t *drive = (ide_drive_t *) data; |
640 | const char *media; | 641 | const char *media; |
641 | int len; | 642 | int len; |
642 | 643 | ||
643 | switch (drive->media) { | 644 | switch (drive->media) { |
644 | case ide_disk: media = "disk\n"; | 645 | case ide_disk: media = "disk\n"; |
645 | break; | 646 | break; |
646 | case ide_cdrom: media = "cdrom\n"; | 647 | case ide_cdrom: media = "cdrom\n"; |
647 | break; | 648 | break; |
648 | case ide_tape: media = "tape\n"; | 649 | case ide_tape: media = "tape\n"; |
649 | break; | 650 | break; |
650 | case ide_floppy:media = "floppy\n"; | 651 | case ide_floppy:media = "floppy\n"; |
651 | break; | 652 | break; |
652 | case ide_optical:media = "optical\n"; | 653 | case ide_optical:media = "optical\n"; |
653 | break; | 654 | break; |
654 | default: media = "UNKNOWN\n"; | 655 | default: media = "UNKNOWN\n"; |
655 | break; | 656 | break; |
656 | } | 657 | } |
657 | strcpy(page,media); | 658 | strcpy(page,media); |
658 | len = strlen(media); | 659 | len = strlen(media); |
659 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 660 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); |
660 | } | 661 | } |
661 | 662 | ||
662 | static ide_proc_entry_t generic_drive_entries[] = { | 663 | static ide_proc_entry_t generic_drive_entries[] = { |
663 | { "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, proc_ide_write_driver }, | 664 | { "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, proc_ide_write_driver }, |
664 | { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, | 665 | { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, |
665 | { "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL }, | 666 | { "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL }, |
666 | { "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL }, | 667 | { "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL }, |
667 | { "settings", S_IFREG|S_IRUSR|S_IWUSR,proc_ide_read_settings, proc_ide_write_settings }, | 668 | { "settings", S_IFREG|S_IRUSR|S_IWUSR,proc_ide_read_settings, proc_ide_write_settings }, |
668 | { NULL, 0, NULL, NULL } | 669 | { NULL, 0, NULL, NULL } |
669 | }; | 670 | }; |
670 | 671 | ||
671 | static void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void *data) | 672 | static void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void *data) |
672 | { | 673 | { |
673 | struct proc_dir_entry *ent; | 674 | struct proc_dir_entry *ent; |
674 | 675 | ||
675 | if (!dir || !p) | 676 | if (!dir || !p) |
676 | return; | 677 | return; |
677 | while (p->name != NULL) { | 678 | while (p->name != NULL) { |
678 | ent = create_proc_entry(p->name, p->mode, dir); | 679 | ent = create_proc_entry(p->name, p->mode, dir); |
679 | if (!ent) return; | 680 | if (!ent) return; |
680 | ent->data = data; | 681 | ent->data = data; |
681 | ent->read_proc = p->read_proc; | 682 | ent->read_proc = p->read_proc; |
682 | ent->write_proc = p->write_proc; | 683 | ent->write_proc = p->write_proc; |
683 | p++; | 684 | p++; |
684 | } | 685 | } |
685 | } | 686 | } |
686 | 687 | ||
687 | static void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p) | 688 | static void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p) |
688 | { | 689 | { |
689 | if (!dir || !p) | 690 | if (!dir || !p) |
690 | return; | 691 | return; |
691 | while (p->name != NULL) { | 692 | while (p->name != NULL) { |
692 | remove_proc_entry(p->name, dir); | 693 | remove_proc_entry(p->name, dir); |
693 | p++; | 694 | p++; |
694 | } | 695 | } |
695 | } | 696 | } |
696 | 697 | ||
697 | void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) | 698 | void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) |
698 | { | 699 | { |
699 | ide_add_proc_entries(drive->proc, driver->proc, drive); | 700 | ide_add_proc_entries(drive->proc, driver->proc, drive); |
700 | } | 701 | } |
701 | 702 | ||
702 | EXPORT_SYMBOL(ide_proc_register_driver); | 703 | EXPORT_SYMBOL(ide_proc_register_driver); |
703 | 704 | ||
704 | /** | 705 | /** |
705 | * ide_proc_unregister_driver - remove driver specific data | 706 | * ide_proc_unregister_driver - remove driver specific data |
706 | * @drive: drive | 707 | * @drive: drive |
707 | * @driver: driver | 708 | * @driver: driver |
708 | * | 709 | * |
709 | * Clean up the driver specific /proc files and IDE settings | 710 | * Clean up the driver specific /proc files and IDE settings |
710 | * for a given drive. | 711 | * for a given drive. |
711 | * | 712 | * |
712 | * Takes ide_setting_mtx and ide_lock. | 713 | * Takes ide_setting_mtx and ide_lock. |
713 | * Caller must hold none of the locks. | 714 | * Caller must hold none of the locks. |
714 | */ | 715 | */ |
715 | 716 | ||
716 | void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) | 717 | void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) |
717 | { | 718 | { |
718 | unsigned long flags; | 719 | unsigned long flags; |
719 | 720 | ||
720 | ide_remove_proc_entries(drive->proc, driver->proc); | 721 | ide_remove_proc_entries(drive->proc, driver->proc); |
721 | 722 | ||
722 | mutex_lock(&ide_setting_mtx); | 723 | mutex_lock(&ide_setting_mtx); |
723 | spin_lock_irqsave(&ide_lock, flags); | 724 | spin_lock_irqsave(&ide_lock, flags); |
724 | /* | 725 | /* |
725 | * ide_setting_mtx protects the settings list | 726 | * ide_setting_mtx protects the settings list |
726 | * ide_lock protects the use of settings | 727 | * ide_lock protects the use of settings |
727 | * | 728 | * |
728 | * so we need to hold both, ide_settings_sem because we want to | 729 | * so we need to hold both, ide_settings_sem because we want to |
729 | * modify the settings list, and ide_lock because we cannot take | 730 | * modify the settings list, and ide_lock because we cannot take |
730 | * a setting out that is being used. | 731 | * a setting out that is being used. |
731 | * | 732 | * |
732 | * OTOH both ide_{read,write}_setting are only ever used under | 733 | * OTOH both ide_{read,write}_setting are only ever used under |
733 | * ide_setting_mtx. | 734 | * ide_setting_mtx. |
734 | */ | 735 | */ |
735 | auto_remove_settings(drive); | 736 | auto_remove_settings(drive); |
736 | spin_unlock_irqrestore(&ide_lock, flags); | 737 | spin_unlock_irqrestore(&ide_lock, flags); |
737 | mutex_unlock(&ide_setting_mtx); | 738 | mutex_unlock(&ide_setting_mtx); |
738 | } | 739 | } |
739 | 740 | ||
740 | EXPORT_SYMBOL(ide_proc_unregister_driver); | 741 | EXPORT_SYMBOL(ide_proc_unregister_driver); |
741 | 742 | ||
742 | void ide_proc_port_register_devices(ide_hwif_t *hwif) | 743 | void ide_proc_port_register_devices(ide_hwif_t *hwif) |
743 | { | 744 | { |
744 | int d; | 745 | int d; |
745 | struct proc_dir_entry *ent; | 746 | struct proc_dir_entry *ent; |
746 | struct proc_dir_entry *parent = hwif->proc; | 747 | struct proc_dir_entry *parent = hwif->proc; |
747 | char name[64]; | 748 | char name[64]; |
748 | 749 | ||
749 | for (d = 0; d < MAX_DRIVES; d++) { | 750 | for (d = 0; d < MAX_DRIVES; d++) { |
750 | ide_drive_t *drive = &hwif->drives[d]; | 751 | ide_drive_t *drive = &hwif->drives[d]; |
751 | 752 | ||
752 | if (!drive->present) | 753 | if (!drive->present) |
753 | continue; | 754 | continue; |
754 | if (drive->proc) | 755 | if (drive->proc) |
755 | continue; | 756 | continue; |
756 | 757 | ||
757 | drive->proc = proc_mkdir(drive->name, parent); | 758 | drive->proc = proc_mkdir(drive->name, parent); |
758 | if (drive->proc) | 759 | if (drive->proc) |
759 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); | 760 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); |
760 | sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name); | 761 | sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name); |
761 | ent = proc_symlink(drive->name, proc_ide_root, name); | 762 | ent = proc_symlink(drive->name, proc_ide_root, name); |
762 | if (!ent) return; | 763 | if (!ent) return; |
763 | } | 764 | } |
764 | } | 765 | } |
765 | 766 | ||
766 | static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) | 767 | static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) |
767 | { | 768 | { |
768 | if (drive->proc) { | 769 | if (drive->proc) { |
769 | ide_remove_proc_entries(drive->proc, generic_drive_entries); | 770 | ide_remove_proc_entries(drive->proc, generic_drive_entries); |
770 | remove_proc_entry(drive->name, proc_ide_root); | 771 | remove_proc_entry(drive->name, proc_ide_root); |
771 | remove_proc_entry(drive->name, hwif->proc); | 772 | remove_proc_entry(drive->name, hwif->proc); |
772 | drive->proc = NULL; | 773 | drive->proc = NULL; |
773 | } | 774 | } |
774 | } | 775 | } |
775 | 776 | ||
776 | static void destroy_proc_ide_drives(ide_hwif_t *hwif) | 777 | static void destroy_proc_ide_drives(ide_hwif_t *hwif) |
777 | { | 778 | { |
778 | int d; | 779 | int d; |
779 | 780 | ||
780 | for (d = 0; d < MAX_DRIVES; d++) { | 781 | for (d = 0; d < MAX_DRIVES; d++) { |
781 | ide_drive_t *drive = &hwif->drives[d]; | 782 | ide_drive_t *drive = &hwif->drives[d]; |
782 | if (drive->proc) | 783 | if (drive->proc) |
783 | destroy_proc_ide_device(hwif, drive); | 784 | destroy_proc_ide_device(hwif, drive); |
784 | } | 785 | } |
785 | } | 786 | } |
786 | 787 | ||
787 | static ide_proc_entry_t hwif_entries[] = { | 788 | static ide_proc_entry_t hwif_entries[] = { |
788 | { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL }, | 789 | { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL }, |
789 | { "mate", S_IFREG|S_IRUGO, proc_ide_read_mate, NULL }, | 790 | { "mate", S_IFREG|S_IRUGO, proc_ide_read_mate, NULL }, |
790 | { "model", S_IFREG|S_IRUGO, proc_ide_read_imodel, NULL }, | 791 | { "model", S_IFREG|S_IRUGO, proc_ide_read_imodel, NULL }, |
791 | { NULL, 0, NULL, NULL } | 792 | { NULL, 0, NULL, NULL } |
792 | }; | 793 | }; |
793 | 794 | ||
794 | void ide_proc_register_port(ide_hwif_t *hwif) | 795 | void ide_proc_register_port(ide_hwif_t *hwif) |
795 | { | 796 | { |
796 | if (!hwif->proc) { | 797 | if (!hwif->proc) { |
797 | hwif->proc = proc_mkdir(hwif->name, proc_ide_root); | 798 | hwif->proc = proc_mkdir(hwif->name, proc_ide_root); |
798 | 799 | ||
799 | if (!hwif->proc) | 800 | if (!hwif->proc) |
800 | return; | 801 | return; |
801 | 802 | ||
802 | ide_add_proc_entries(hwif->proc, hwif_entries, hwif); | 803 | ide_add_proc_entries(hwif->proc, hwif_entries, hwif); |
803 | } | 804 | } |
804 | } | 805 | } |
805 | 806 | ||
806 | #ifdef CONFIG_BLK_DEV_IDEPCI | 807 | #ifdef CONFIG_BLK_DEV_IDEPCI |
807 | void ide_pci_create_host_proc(const char *name, get_info_t *get_info) | 808 | void ide_pci_create_host_proc(const char *name, get_info_t *get_info) |
808 | { | 809 | { |
809 | create_proc_info_entry(name, 0, proc_ide_root, get_info); | 810 | create_proc_info_entry(name, 0, proc_ide_root, get_info); |
810 | } | 811 | } |
811 | 812 | ||
812 | EXPORT_SYMBOL_GPL(ide_pci_create_host_proc); | 813 | EXPORT_SYMBOL_GPL(ide_pci_create_host_proc); |
813 | #endif | 814 | #endif |
814 | 815 | ||
815 | void ide_proc_unregister_port(ide_hwif_t *hwif) | 816 | void ide_proc_unregister_port(ide_hwif_t *hwif) |
816 | { | 817 | { |
817 | if (hwif->proc) { | 818 | if (hwif->proc) { |
818 | destroy_proc_ide_drives(hwif); | 819 | destroy_proc_ide_drives(hwif); |
819 | ide_remove_proc_entries(hwif->proc, hwif_entries); | 820 | ide_remove_proc_entries(hwif->proc, hwif_entries); |
820 | remove_proc_entry(hwif->name, proc_ide_root); | 821 | remove_proc_entry(hwif->name, proc_ide_root); |
821 | hwif->proc = NULL; | 822 | hwif->proc = NULL; |
822 | } | 823 | } |
823 | } | 824 | } |
824 | 825 | ||
825 | static int proc_print_driver(struct device_driver *drv, void *data) | 826 | static int proc_print_driver(struct device_driver *drv, void *data) |
826 | { | 827 | { |
827 | ide_driver_t *ide_drv = container_of(drv, ide_driver_t, gen_driver); | 828 | ide_driver_t *ide_drv = container_of(drv, ide_driver_t, gen_driver); |
828 | struct seq_file *s = data; | 829 | struct seq_file *s = data; |
829 | 830 | ||
830 | seq_printf(s, "%s version %s\n", drv->name, ide_drv->version); | 831 | seq_printf(s, "%s version %s\n", drv->name, ide_drv->version); |
831 | 832 | ||
832 | return 0; | 833 | return 0; |
833 | } | 834 | } |
834 | 835 | ||
835 | static int ide_drivers_show(struct seq_file *s, void *p) | 836 | static int ide_drivers_show(struct seq_file *s, void *p) |
836 | { | 837 | { |
837 | int err; | 838 | int err; |
838 | 839 | ||
839 | err = bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver); | 840 | err = bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver); |
840 | if (err < 0) | 841 | if (err < 0) |
841 | printk(KERN_WARNING "IDE: %s: bus_for_each_drv error: %d\n", | 842 | printk(KERN_WARNING "IDE: %s: bus_for_each_drv error: %d\n", |
842 | __FUNCTION__, err); | 843 | __FUNCTION__, err); |
843 | return 0; | 844 | return 0; |
844 | } | 845 | } |
845 | 846 | ||
846 | static int ide_drivers_open(struct inode *inode, struct file *file) | 847 | static int ide_drivers_open(struct inode *inode, struct file *file) |
847 | { | 848 | { |
848 | return single_open(file, &ide_drivers_show, NULL); | 849 | return single_open(file, &ide_drivers_show, NULL); |
849 | } | 850 | } |
850 | 851 | ||
851 | static const struct file_operations ide_drivers_operations = { | 852 | static const struct file_operations ide_drivers_operations = { |
852 | .open = ide_drivers_open, | 853 | .open = ide_drivers_open, |
853 | .read = seq_read, | 854 | .read = seq_read, |
854 | .llseek = seq_lseek, | 855 | .llseek = seq_lseek, |
855 | .release = single_release, | 856 | .release = single_release, |
856 | }; | 857 | }; |
857 | 858 | ||
858 | void proc_ide_create(void) | 859 | void proc_ide_create(void) |
859 | { | 860 | { |
860 | struct proc_dir_entry *entry; | 861 | struct proc_dir_entry *entry; |
861 | 862 | ||
862 | proc_ide_root = proc_mkdir("ide", NULL); | 863 | proc_ide_root = proc_mkdir("ide", NULL); |
863 | 864 | ||
864 | if (!proc_ide_root) | 865 | if (!proc_ide_root) |
865 | return; | 866 | return; |
866 | 867 | ||
867 | entry = create_proc_entry("drivers", 0, proc_ide_root); | 868 | entry = create_proc_entry("drivers", 0, proc_ide_root); |
868 | if (entry) | 869 | if (entry) |
869 | entry->proc_fops = &ide_drivers_operations; | 870 | entry->proc_fops = &ide_drivers_operations; |
870 | } | 871 | } |
871 | 872 | ||
872 | void proc_ide_destroy(void) | 873 | void proc_ide_destroy(void) |
873 | { | 874 | { |
874 | remove_proc_entry("drivers", proc_ide_root); | 875 | remove_proc_entry("drivers", proc_ide_root); |
875 | remove_proc_entry("ide", NULL); | 876 | remove_proc_entry("ide", NULL); |
876 | } | 877 | } |
877 | 878 |
include/linux/ide.h
1 | #ifndef _IDE_H | 1 | #ifndef _IDE_H |
2 | #define _IDE_H | 2 | #define _IDE_H |
3 | /* | 3 | /* |
4 | * linux/include/linux/ide.h | 4 | * linux/include/linux/ide.h |
5 | * | 5 | * |
6 | * Copyright (C) 1994-2002 Linus Torvalds & authors | 6 | * Copyright (C) 1994-2002 Linus Torvalds & authors |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/ioport.h> | 10 | #include <linux/ioport.h> |
11 | #include <linux/hdreg.h> | 11 | #include <linux/hdreg.h> |
12 | #include <linux/blkdev.h> | 12 | #include <linux/blkdev.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
16 | #include <linux/bio.h> | 16 | #include <linux/bio.h> |
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
20 | #ifdef CONFIG_BLK_DEV_IDEACPI | 20 | #ifdef CONFIG_BLK_DEV_IDEACPI |
21 | #include <acpi/acpi.h> | 21 | #include <acpi/acpi.h> |
22 | #endif | 22 | #endif |
23 | #include <asm/byteorder.h> | 23 | #include <asm/byteorder.h> |
24 | #include <asm/system.h> | 24 | #include <asm/system.h> |
25 | #include <asm/io.h> | 25 | #include <asm/io.h> |
26 | #include <asm/semaphore.h> | 26 | #include <asm/semaphore.h> |
27 | #include <asm/mutex.h> | 27 | #include <asm/mutex.h> |
28 | 28 | ||
29 | #if defined(CRIS) || defined(FRV) | 29 | #if defined(CRIS) || defined(FRV) |
30 | # define SUPPORT_VLB_SYNC 0 | 30 | # define SUPPORT_VLB_SYNC 0 |
31 | #else | 31 | #else |
32 | # define SUPPORT_VLB_SYNC 1 | 32 | # define SUPPORT_VLB_SYNC 1 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Used to indicate "no IRQ", should be a value that cannot be an IRQ | 36 | * Used to indicate "no IRQ", should be a value that cannot be an IRQ |
37 | * number. | 37 | * number. |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #define IDE_NO_IRQ (-1) | 40 | #define IDE_NO_IRQ (-1) |
41 | 41 | ||
42 | typedef unsigned char byte; /* used everywhere */ | 42 | typedef unsigned char byte; /* used everywhere */ |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * Probably not wise to fiddle with these | 45 | * Probably not wise to fiddle with these |
46 | */ | 46 | */ |
47 | #define ERROR_MAX 8 /* Max read/write errors per sector */ | 47 | #define ERROR_MAX 8 /* Max read/write errors per sector */ |
48 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ | 48 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ |
49 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ | 49 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Tune flags | 52 | * Tune flags |
53 | */ | 53 | */ |
54 | #define IDE_TUNE_NOAUTO 2 | 54 | #define IDE_TUNE_NOAUTO 2 |
55 | #define IDE_TUNE_AUTO 1 | 55 | #define IDE_TUNE_AUTO 1 |
56 | #define IDE_TUNE_DEFAULT 0 | 56 | #define IDE_TUNE_DEFAULT 0 |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * state flags | 59 | * state flags |
60 | */ | 60 | */ |
61 | 61 | ||
62 | #define DMA_PIO_RETRY 1 /* retrying in PIO */ | 62 | #define DMA_PIO_RETRY 1 /* retrying in PIO */ |
63 | 63 | ||
64 | #define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) | 64 | #define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) |
65 | #define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) | 65 | #define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Definitions for accessing IDE controller registers | 68 | * Definitions for accessing IDE controller registers |
69 | */ | 69 | */ |
70 | #define IDE_NR_PORTS (10) | 70 | #define IDE_NR_PORTS (10) |
71 | 71 | ||
72 | #define IDE_DATA_OFFSET (0) | 72 | #define IDE_DATA_OFFSET (0) |
73 | #define IDE_ERROR_OFFSET (1) | 73 | #define IDE_ERROR_OFFSET (1) |
74 | #define IDE_NSECTOR_OFFSET (2) | 74 | #define IDE_NSECTOR_OFFSET (2) |
75 | #define IDE_SECTOR_OFFSET (3) | 75 | #define IDE_SECTOR_OFFSET (3) |
76 | #define IDE_LCYL_OFFSET (4) | 76 | #define IDE_LCYL_OFFSET (4) |
77 | #define IDE_HCYL_OFFSET (5) | 77 | #define IDE_HCYL_OFFSET (5) |
78 | #define IDE_SELECT_OFFSET (6) | 78 | #define IDE_SELECT_OFFSET (6) |
79 | #define IDE_STATUS_OFFSET (7) | 79 | #define IDE_STATUS_OFFSET (7) |
80 | #define IDE_CONTROL_OFFSET (8) | 80 | #define IDE_CONTROL_OFFSET (8) |
81 | #define IDE_IRQ_OFFSET (9) | 81 | #define IDE_IRQ_OFFSET (9) |
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 | ||
86 | #define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) | 86 | #define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) |
87 | #define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) | 87 | #define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) |
88 | #define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) | 88 | #define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) |
89 | #define IDE_SECTOR_REG (HWIF(drive)->io_ports[IDE_SECTOR_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]) | 90 | #define IDE_LCYL_REG (HWIF(drive)->io_ports[IDE_LCYL_OFFSET]) |
91 | #define IDE_HCYL_REG (HWIF(drive)->io_ports[IDE_HCYL_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]) | 92 | #define IDE_SELECT_REG (HWIF(drive)->io_ports[IDE_SELECT_OFFSET]) |
93 | #define IDE_STATUS_REG (HWIF(drive)->io_ports[IDE_STATUS_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]) | 94 | #define IDE_CONTROL_REG (HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]) |
95 | #define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET]) | 95 | #define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET]) |
96 | 96 | ||
97 | #define IDE_FEATURE_REG IDE_ERROR_REG | 97 | #define IDE_FEATURE_REG IDE_ERROR_REG |
98 | #define IDE_COMMAND_REG IDE_STATUS_REG | 98 | #define IDE_COMMAND_REG IDE_STATUS_REG |
99 | #define IDE_ALTSTATUS_REG IDE_CONTROL_REG | 99 | #define IDE_ALTSTATUS_REG IDE_CONTROL_REG |
100 | #define IDE_IREASON_REG IDE_NSECTOR_REG | 100 | #define IDE_IREASON_REG IDE_NSECTOR_REG |
101 | #define IDE_BCOUNTL_REG IDE_LCYL_REG | 101 | #define IDE_BCOUNTL_REG IDE_LCYL_REG |
102 | #define IDE_BCOUNTH_REG IDE_HCYL_REG | 102 | #define IDE_BCOUNTH_REG IDE_HCYL_REG |
103 | 103 | ||
104 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) | 104 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) |
105 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) | 105 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) |
106 | #define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) | 106 | #define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) |
107 | #define BAD_STAT (BAD_R_STAT | DRQ_STAT) | 107 | #define BAD_STAT (BAD_R_STAT | DRQ_STAT) |
108 | #define DRIVE_READY (READY_STAT | SEEK_STAT) | 108 | #define DRIVE_READY (READY_STAT | SEEK_STAT) |
109 | 109 | ||
110 | #define BAD_CRC (ABRT_ERR | ICRC_ERR) | 110 | #define BAD_CRC (ABRT_ERR | ICRC_ERR) |
111 | 111 | ||
112 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ | 112 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ |
113 | 113 | ||
114 | #define SATA_STATUS_OFFSET (0) | 114 | #define SATA_STATUS_OFFSET (0) |
115 | #define SATA_ERROR_OFFSET (1) | 115 | #define SATA_ERROR_OFFSET (1) |
116 | #define SATA_CONTROL_OFFSET (2) | 116 | #define SATA_CONTROL_OFFSET (2) |
117 | 117 | ||
118 | #define SATA_MISC_OFFSET (0) | 118 | #define SATA_MISC_OFFSET (0) |
119 | #define SATA_PHY_OFFSET (1) | 119 | #define SATA_PHY_OFFSET (1) |
120 | #define SATA_IEN_OFFSET (2) | 120 | #define SATA_IEN_OFFSET (2) |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * Our Physical Region Descriptor (PRD) table should be large enough | 123 | * Our Physical Region Descriptor (PRD) table should be large enough |
124 | * to handle the biggest I/O request we are likely to see. Since requests | 124 | * to handle the biggest I/O request we are likely to see. Since requests |
125 | * can have no more than 256 sectors, and since the typical blocksize is | 125 | * can have no more than 256 sectors, and since the typical blocksize is |
126 | * two or more sectors, we could get by with a limit of 128 entries here for | 126 | * two or more sectors, we could get by with a limit of 128 entries here for |
127 | * the usual worst case. Most requests seem to include some contiguous blocks, | 127 | * the usual worst case. Most requests seem to include some contiguous blocks, |
128 | * further reducing the number of table entries required. | 128 | * further reducing the number of table entries required. |
129 | * | 129 | * |
130 | * The driver reverts to PIO mode for individual requests that exceed | 130 | * The driver reverts to PIO mode for individual requests that exceed |
131 | * this limit (possible with 512 byte blocksizes, eg. MSDOS f/s), so handling | 131 | * this limit (possible with 512 byte blocksizes, eg. MSDOS f/s), so handling |
132 | * 100% of all crazy scenarios here is not necessary. | 132 | * 100% of all crazy scenarios here is not necessary. |
133 | * | 133 | * |
134 | * As it turns out though, we must allocate a full 4KB page for this, | 134 | * As it turns out though, we must allocate a full 4KB page for this, |
135 | * so the two PRD tables (ide0 & ide1) will each get half of that, | 135 | * so the two PRD tables (ide0 & ide1) will each get half of that, |
136 | * allowing each to have about 256 entries (8 bytes each) from this. | 136 | * allowing each to have about 256 entries (8 bytes each) from this. |
137 | */ | 137 | */ |
138 | #define PRD_BYTES 8 | 138 | #define PRD_BYTES 8 |
139 | #define PRD_ENTRIES 256 | 139 | #define PRD_ENTRIES 256 |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * Some more useful definitions | 142 | * Some more useful definitions |
143 | */ | 143 | */ |
144 | #define PARTN_BITS 6 /* number of minor dev bits for partitions */ | 144 | #define PARTN_BITS 6 /* number of minor dev bits for partitions */ |
145 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ | 145 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ |
146 | #define SECTOR_SIZE 512 | 146 | #define SECTOR_SIZE 512 |
147 | #define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */ | 147 | #define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */ |
148 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) | 148 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) |
149 | 149 | ||
150 | /* | 150 | /* |
151 | * Timeouts for various operations: | 151 | * Timeouts for various operations: |
152 | */ | 152 | */ |
153 | #define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */ | 153 | #define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */ |
154 | #define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ | 154 | #define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ |
155 | #define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */ | 155 | #define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */ |
156 | #define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ | 156 | #define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ |
157 | #define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ | 157 | #define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ |
158 | #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ | 158 | #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ |
159 | 159 | ||
160 | /* | 160 | /* |
161 | * Check for an interrupt and acknowledge the interrupt status | 161 | * Check for an interrupt and acknowledge the interrupt status |
162 | */ | 162 | */ |
163 | struct hwif_s; | 163 | struct hwif_s; |
164 | typedef int (ide_ack_intr_t)(struct hwif_s *); | 164 | typedef int (ide_ack_intr_t)(struct hwif_s *); |
165 | 165 | ||
166 | /* | 166 | /* |
167 | * hwif_chipset_t is used to keep track of the specific hardware | 167 | * hwif_chipset_t is used to keep track of the specific hardware |
168 | * chipset used by each IDE interface, if known. | 168 | * chipset used by each IDE interface, if known. |
169 | */ | 169 | */ |
170 | enum { ide_unknown, ide_generic, ide_pci, | 170 | enum { ide_unknown, ide_generic, ide_pci, |
171 | ide_cmd640, ide_dtc2278, ide_ali14xx, | 171 | ide_cmd640, ide_dtc2278, ide_ali14xx, |
172 | ide_qd65xx, ide_umc8672, ide_ht6560b, | 172 | ide_qd65xx, ide_umc8672, ide_ht6560b, |
173 | ide_rz1000, ide_trm290, | 173 | ide_rz1000, ide_trm290, |
174 | ide_cmd646, ide_cy82c693, ide_4drives, | 174 | ide_cmd646, ide_cy82c693, ide_4drives, |
175 | ide_pmac, ide_etrax100, ide_acorn, | 175 | ide_pmac, ide_etrax100, ide_acorn, |
176 | ide_au1xxx, ide_forced | 176 | ide_au1xxx, ide_palm3710, ide_forced |
177 | }; | 177 | }; |
178 | 178 | ||
179 | typedef u8 hwif_chipset_t; | 179 | typedef u8 hwif_chipset_t; |
180 | 180 | ||
181 | /* | 181 | /* |
182 | * Structure to hold all information about the location of this port | 182 | * Structure to hold all information about the location of this port |
183 | */ | 183 | */ |
184 | typedef struct hw_regs_s { | 184 | typedef struct hw_regs_s { |
185 | unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ | 185 | unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ |
186 | int irq; /* our irq number */ | 186 | int irq; /* our irq number */ |
187 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ | 187 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ |
188 | hwif_chipset_t chipset; | 188 | hwif_chipset_t chipset; |
189 | struct device *dev; | 189 | struct device *dev; |
190 | } hw_regs_t; | 190 | } hw_regs_t; |
191 | 191 | ||
192 | struct hwif_s * ide_find_port(unsigned long); | 192 | struct hwif_s * ide_find_port(unsigned long); |
193 | struct hwif_s *ide_deprecated_find_port(unsigned long); | 193 | struct hwif_s *ide_deprecated_find_port(unsigned long); |
194 | void ide_init_port_data(struct hwif_s *, unsigned int); | 194 | void ide_init_port_data(struct hwif_s *, unsigned int); |
195 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); | 195 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); |
196 | 196 | ||
197 | struct ide_drive_s; | 197 | struct ide_drive_s; |
198 | int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *), | 198 | int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *), |
199 | struct hwif_s **); | 199 | struct hwif_s **); |
200 | 200 | ||
201 | void ide_setup_ports( hw_regs_t *hw, | 201 | void ide_setup_ports( hw_regs_t *hw, |
202 | unsigned long base, | 202 | unsigned long base, |
203 | int *offsets, | 203 | int *offsets, |
204 | unsigned long ctrl, | 204 | unsigned long ctrl, |
205 | unsigned long intr, | 205 | unsigned long intr, |
206 | ide_ack_intr_t *ack_intr, | 206 | ide_ack_intr_t *ack_intr, |
207 | #if 0 | 207 | #if 0 |
208 | ide_io_ops_t *iops, | 208 | ide_io_ops_t *iops, |
209 | #endif | 209 | #endif |
210 | int irq); | 210 | int irq); |
211 | 211 | ||
212 | static inline void ide_std_init_ports(hw_regs_t *hw, | 212 | static inline void ide_std_init_ports(hw_regs_t *hw, |
213 | unsigned long io_addr, | 213 | unsigned long io_addr, |
214 | unsigned long ctl_addr) | 214 | unsigned long ctl_addr) |
215 | { | 215 | { |
216 | unsigned int i; | 216 | unsigned int i; |
217 | 217 | ||
218 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) | 218 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) |
219 | hw->io_ports[i] = io_addr++; | 219 | hw->io_ports[i] = io_addr++; |
220 | 220 | ||
221 | hw->io_ports[IDE_CONTROL_OFFSET] = ctl_addr; | 221 | hw->io_ports[IDE_CONTROL_OFFSET] = ctl_addr; |
222 | } | 222 | } |
223 | 223 | ||
224 | #include <asm/ide.h> | 224 | #include <asm/ide.h> |
225 | 225 | ||
226 | #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) | 226 | #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) |
227 | #undef MAX_HWIFS | 227 | #undef MAX_HWIFS |
228 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | 228 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS |
229 | #endif | 229 | #endif |
230 | 230 | ||
231 | /* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ | 231 | /* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ |
232 | #ifndef IDE_ARCH_OBSOLETE_DEFAULTS | 232 | #ifndef IDE_ARCH_OBSOLETE_DEFAULTS |
233 | # define ide_default_io_base(index) (0) | 233 | # define ide_default_io_base(index) (0) |
234 | # define ide_default_irq(base) (0) | 234 | # define ide_default_irq(base) (0) |
235 | # define ide_init_default_irq(base) (0) | 235 | # define ide_init_default_irq(base) (0) |
236 | #endif | 236 | #endif |
237 | 237 | ||
238 | #ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT | 238 | #ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT |
239 | static inline void ide_init_hwif_ports(hw_regs_t *hw, | 239 | static inline void ide_init_hwif_ports(hw_regs_t *hw, |
240 | unsigned long io_addr, | 240 | unsigned long io_addr, |
241 | unsigned long ctl_addr, | 241 | unsigned long ctl_addr, |
242 | int *irq) | 242 | int *irq) |
243 | { | 243 | { |
244 | if (!ctl_addr) | 244 | if (!ctl_addr) |
245 | ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr)); | 245 | ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr)); |
246 | else | 246 | else |
247 | ide_std_init_ports(hw, io_addr, ctl_addr); | 247 | ide_std_init_ports(hw, io_addr, ctl_addr); |
248 | 248 | ||
249 | if (irq) | 249 | if (irq) |
250 | *irq = 0; | 250 | *irq = 0; |
251 | 251 | ||
252 | hw->io_ports[IDE_IRQ_OFFSET] = 0; | 252 | hw->io_ports[IDE_IRQ_OFFSET] = 0; |
253 | 253 | ||
254 | #ifdef CONFIG_PPC32 | 254 | #ifdef CONFIG_PPC32 |
255 | if (ppc_ide_md.ide_init_hwif) | 255 | if (ppc_ide_md.ide_init_hwif) |
256 | ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq); | 256 | ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq); |
257 | #endif | 257 | #endif |
258 | } | 258 | } |
259 | #else | 259 | #else |
260 | static inline void ide_init_hwif_ports(hw_regs_t *hw, | 260 | static inline void ide_init_hwif_ports(hw_regs_t *hw, |
261 | unsigned long io_addr, | 261 | unsigned long io_addr, |
262 | unsigned long ctl_addr, | 262 | unsigned long ctl_addr, |
263 | int *irq) | 263 | int *irq) |
264 | { | 264 | { |
265 | if (io_addr || ctl_addr) | 265 | if (io_addr || ctl_addr) |
266 | printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); | 266 | printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); |
267 | } | 267 | } |
268 | #endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */ | 268 | #endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */ |
269 | 269 | ||
270 | /* Currently only m68k, apus and m8xx need it */ | 270 | /* Currently only m68k, apus and m8xx need it */ |
271 | #ifndef IDE_ARCH_ACK_INTR | 271 | #ifndef IDE_ARCH_ACK_INTR |
272 | # define ide_ack_intr(hwif) (1) | 272 | # define ide_ack_intr(hwif) (1) |
273 | #endif | 273 | #endif |
274 | 274 | ||
275 | /* Currently only Atari needs it */ | 275 | /* Currently only Atari needs it */ |
276 | #ifndef IDE_ARCH_LOCK | 276 | #ifndef IDE_ARCH_LOCK |
277 | # define ide_release_lock() do {} while (0) | 277 | # define ide_release_lock() do {} while (0) |
278 | # define ide_get_lock(hdlr, data) do {} while (0) | 278 | # define ide_get_lock(hdlr, data) do {} while (0) |
279 | #endif /* IDE_ARCH_LOCK */ | 279 | #endif /* IDE_ARCH_LOCK */ |
280 | 280 | ||
281 | /* | 281 | /* |
282 | * Now for the data we need to maintain per-drive: ide_drive_t | 282 | * Now for the data we need to maintain per-drive: ide_drive_t |
283 | */ | 283 | */ |
284 | 284 | ||
285 | #define ide_scsi 0x21 | 285 | #define ide_scsi 0x21 |
286 | #define ide_disk 0x20 | 286 | #define ide_disk 0x20 |
287 | #define ide_optical 0x7 | 287 | #define ide_optical 0x7 |
288 | #define ide_cdrom 0x5 | 288 | #define ide_cdrom 0x5 |
289 | #define ide_tape 0x1 | 289 | #define ide_tape 0x1 |
290 | #define ide_floppy 0x0 | 290 | #define ide_floppy 0x0 |
291 | 291 | ||
292 | /* | 292 | /* |
293 | * Special Driver Flags | 293 | * Special Driver Flags |
294 | * | 294 | * |
295 | * set_geometry : respecify drive geometry | 295 | * set_geometry : respecify drive geometry |
296 | * recalibrate : seek to cyl 0 | 296 | * recalibrate : seek to cyl 0 |
297 | * set_multmode : set multmode count | 297 | * set_multmode : set multmode count |
298 | * set_tune : tune interface for drive | 298 | * set_tune : tune interface for drive |
299 | * serviced : service command | 299 | * serviced : service command |
300 | * reserved : unused | 300 | * reserved : unused |
301 | */ | 301 | */ |
302 | typedef union { | 302 | typedef union { |
303 | unsigned all : 8; | 303 | unsigned all : 8; |
304 | struct { | 304 | struct { |
305 | unsigned set_geometry : 1; | 305 | unsigned set_geometry : 1; |
306 | unsigned recalibrate : 1; | 306 | unsigned recalibrate : 1; |
307 | unsigned set_multmode : 1; | 307 | unsigned set_multmode : 1; |
308 | unsigned set_tune : 1; | 308 | unsigned set_tune : 1; |
309 | unsigned serviced : 1; | 309 | unsigned serviced : 1; |
310 | unsigned reserved : 3; | 310 | unsigned reserved : 3; |
311 | } b; | 311 | } b; |
312 | } special_t; | 312 | } special_t; |
313 | 313 | ||
314 | /* | 314 | /* |
315 | * ATA-IDE Select Register, aka Device-Head | 315 | * ATA-IDE Select Register, aka Device-Head |
316 | * | 316 | * |
317 | * head : always zeros here | 317 | * head : always zeros here |
318 | * unit : drive select number: 0/1 | 318 | * unit : drive select number: 0/1 |
319 | * bit5 : always 1 | 319 | * bit5 : always 1 |
320 | * lba : using LBA instead of CHS | 320 | * lba : using LBA instead of CHS |
321 | * bit7 : always 1 | 321 | * bit7 : always 1 |
322 | */ | 322 | */ |
323 | typedef union { | 323 | typedef union { |
324 | unsigned all : 8; | 324 | unsigned all : 8; |
325 | struct { | 325 | struct { |
326 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 326 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
327 | unsigned head : 4; | 327 | unsigned head : 4; |
328 | unsigned unit : 1; | 328 | unsigned unit : 1; |
329 | unsigned bit5 : 1; | 329 | unsigned bit5 : 1; |
330 | unsigned lba : 1; | 330 | unsigned lba : 1; |
331 | unsigned bit7 : 1; | 331 | unsigned bit7 : 1; |
332 | #elif defined(__BIG_ENDIAN_BITFIELD) | 332 | #elif defined(__BIG_ENDIAN_BITFIELD) |
333 | unsigned bit7 : 1; | 333 | unsigned bit7 : 1; |
334 | unsigned lba : 1; | 334 | unsigned lba : 1; |
335 | unsigned bit5 : 1; | 335 | unsigned bit5 : 1; |
336 | unsigned unit : 1; | 336 | unsigned unit : 1; |
337 | unsigned head : 4; | 337 | unsigned head : 4; |
338 | #else | 338 | #else |
339 | #error "Please fix <asm/byteorder.h>" | 339 | #error "Please fix <asm/byteorder.h>" |
340 | #endif | 340 | #endif |
341 | } b; | 341 | } b; |
342 | } select_t, ata_select_t; | 342 | } select_t, ata_select_t; |
343 | 343 | ||
344 | /* | 344 | /* |
345 | * Status returned from various ide_ functions | 345 | * Status returned from various ide_ functions |
346 | */ | 346 | */ |
347 | typedef enum { | 347 | typedef enum { |
348 | ide_stopped, /* no drive operation was started */ | 348 | ide_stopped, /* no drive operation was started */ |
349 | ide_started, /* a drive operation was started, handler was set */ | 349 | ide_started, /* a drive operation was started, handler was set */ |
350 | } ide_startstop_t; | 350 | } ide_startstop_t; |
351 | 351 | ||
352 | struct ide_driver_s; | 352 | struct ide_driver_s; |
353 | struct ide_settings_s; | 353 | struct ide_settings_s; |
354 | 354 | ||
355 | #ifdef CONFIG_BLK_DEV_IDEACPI | 355 | #ifdef CONFIG_BLK_DEV_IDEACPI |
356 | struct ide_acpi_drive_link; | 356 | struct ide_acpi_drive_link; |
357 | struct ide_acpi_hwif_link; | 357 | struct ide_acpi_hwif_link; |
358 | #endif | 358 | #endif |
359 | 359 | ||
360 | typedef struct ide_drive_s { | 360 | typedef struct ide_drive_s { |
361 | char name[4]; /* drive name, such as "hda" */ | 361 | char name[4]; /* drive name, such as "hda" */ |
362 | char driver_req[10]; /* requests specific driver */ | 362 | char driver_req[10]; /* requests specific driver */ |
363 | 363 | ||
364 | struct request_queue *queue; /* request queue */ | 364 | struct request_queue *queue; /* request queue */ |
365 | 365 | ||
366 | struct request *rq; /* current request */ | 366 | struct request *rq; /* current request */ |
367 | struct ide_drive_s *next; /* circular list of hwgroup drives */ | 367 | struct ide_drive_s *next; /* circular list of hwgroup drives */ |
368 | void *driver_data; /* extra driver data */ | 368 | void *driver_data; /* extra driver data */ |
369 | struct hd_driveid *id; /* drive model identification info */ | 369 | struct hd_driveid *id; /* drive model identification info */ |
370 | #ifdef CONFIG_IDE_PROC_FS | 370 | #ifdef CONFIG_IDE_PROC_FS |
371 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 371 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
372 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ | 372 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ |
373 | #endif | 373 | #endif |
374 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ | 374 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ |
375 | 375 | ||
376 | unsigned long sleep; /* sleep until this time */ | 376 | unsigned long sleep; /* sleep until this time */ |
377 | unsigned long service_start; /* time we started last request */ | 377 | unsigned long service_start; /* time we started last request */ |
378 | unsigned long service_time; /* service time of last request */ | 378 | unsigned long service_time; /* service time of last request */ |
379 | unsigned long timeout; /* max time to wait for irq */ | 379 | unsigned long timeout; /* max time to wait for irq */ |
380 | 380 | ||
381 | special_t special; /* special action flags */ | 381 | special_t special; /* special action flags */ |
382 | select_t select; /* basic drive/head select reg value */ | 382 | select_t select; /* basic drive/head select reg value */ |
383 | 383 | ||
384 | u8 keep_settings; /* restore settings after drive reset */ | 384 | u8 keep_settings; /* restore settings after drive reset */ |
385 | u8 using_dma; /* disk is using dma for read/write */ | 385 | u8 using_dma; /* disk is using dma for read/write */ |
386 | u8 retry_pio; /* retrying dma capable host in pio */ | 386 | u8 retry_pio; /* retrying dma capable host in pio */ |
387 | u8 state; /* retry state */ | 387 | u8 state; /* retry state */ |
388 | u8 waiting_for_dma; /* dma currently in progress */ | 388 | u8 waiting_for_dma; /* dma currently in progress */ |
389 | u8 unmask; /* okay to unmask other irqs */ | 389 | u8 unmask; /* okay to unmask other irqs */ |
390 | u8 noflush; /* don't attempt flushes */ | 390 | u8 noflush; /* don't attempt flushes */ |
391 | u8 dsc_overlap; /* DSC overlap */ | 391 | u8 dsc_overlap; /* DSC overlap */ |
392 | u8 nice1; /* give potential excess bandwidth */ | 392 | u8 nice1; /* give potential excess bandwidth */ |
393 | 393 | ||
394 | unsigned present : 1; /* drive is physically present */ | 394 | unsigned present : 1; /* drive is physically present */ |
395 | unsigned dead : 1; /* device ejected hint */ | 395 | unsigned dead : 1; /* device ejected hint */ |
396 | unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */ | 396 | unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */ |
397 | unsigned noprobe : 1; /* from: hdx=noprobe */ | 397 | unsigned noprobe : 1; /* from: hdx=noprobe */ |
398 | unsigned removable : 1; /* 1 if need to do check_media_change */ | 398 | unsigned removable : 1; /* 1 if need to do check_media_change */ |
399 | unsigned attach : 1; /* needed for removable devices */ | 399 | unsigned attach : 1; /* needed for removable devices */ |
400 | unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ | 400 | unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ |
401 | unsigned no_unmask : 1; /* disallow setting unmask bit */ | 401 | unsigned no_unmask : 1; /* disallow setting unmask bit */ |
402 | unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ | 402 | unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ |
403 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ | 403 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ |
404 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ | 404 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ |
405 | unsigned nodma : 1; /* disallow DMA */ | 405 | unsigned nodma : 1; /* disallow DMA */ |
406 | unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ | 406 | unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ |
407 | unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ | 407 | unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ |
408 | unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ | 408 | unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ |
409 | unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ | 409 | unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ |
410 | unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ | 410 | unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ |
411 | unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ | 411 | unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ |
412 | unsigned post_reset : 1; | 412 | unsigned post_reset : 1; |
413 | unsigned udma33_warned : 1; | 413 | unsigned udma33_warned : 1; |
414 | 414 | ||
415 | u8 addressing; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */ | 415 | u8 addressing; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */ |
416 | u8 quirk_list; /* considered quirky, set for a specific host */ | 416 | u8 quirk_list; /* considered quirky, set for a specific host */ |
417 | u8 init_speed; /* transfer rate set at boot */ | 417 | u8 init_speed; /* transfer rate set at boot */ |
418 | u8 current_speed; /* current transfer rate set */ | 418 | u8 current_speed; /* current transfer rate set */ |
419 | u8 desired_speed; /* desired transfer rate set */ | 419 | u8 desired_speed; /* desired transfer rate set */ |
420 | u8 dn; /* now wide spread use */ | 420 | u8 dn; /* now wide spread use */ |
421 | u8 wcache; /* status of write cache */ | 421 | u8 wcache; /* status of write cache */ |
422 | u8 acoustic; /* acoustic management */ | 422 | u8 acoustic; /* acoustic management */ |
423 | u8 media; /* disk, cdrom, tape, floppy, ... */ | 423 | u8 media; /* disk, cdrom, tape, floppy, ... */ |
424 | u8 ctl; /* "normal" value for IDE_CONTROL_REG */ | 424 | u8 ctl; /* "normal" value for IDE_CONTROL_REG */ |
425 | u8 ready_stat; /* min status value for drive ready */ | 425 | u8 ready_stat; /* min status value for drive ready */ |
426 | u8 mult_count; /* current multiple sector setting */ | 426 | u8 mult_count; /* current multiple sector setting */ |
427 | u8 mult_req; /* requested multiple sector setting */ | 427 | u8 mult_req; /* requested multiple sector setting */ |
428 | u8 tune_req; /* requested drive tuning setting */ | 428 | u8 tune_req; /* requested drive tuning setting */ |
429 | u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ | 429 | u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ |
430 | u8 bad_wstat; /* used for ignoring WRERR_STAT */ | 430 | u8 bad_wstat; /* used for ignoring WRERR_STAT */ |
431 | u8 nowerr; /* used for ignoring WRERR_STAT */ | 431 | u8 nowerr; /* used for ignoring WRERR_STAT */ |
432 | u8 sect0; /* offset of first sector for DM6:DDO */ | 432 | u8 sect0; /* offset of first sector for DM6:DDO */ |
433 | u8 head; /* "real" number of heads */ | 433 | u8 head; /* "real" number of heads */ |
434 | u8 sect; /* "real" sectors per track */ | 434 | u8 sect; /* "real" sectors per track */ |
435 | u8 bios_head; /* BIOS/fdisk/LILO number of heads */ | 435 | u8 bios_head; /* BIOS/fdisk/LILO number of heads */ |
436 | u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ | 436 | u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ |
437 | 437 | ||
438 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ | 438 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ |
439 | unsigned int cyl; /* "real" number of cyls */ | 439 | unsigned int cyl; /* "real" number of cyls */ |
440 | unsigned int drive_data; /* used by set_pio_mode/selectproc */ | 440 | unsigned int drive_data; /* used by set_pio_mode/selectproc */ |
441 | unsigned int failures; /* current failure count */ | 441 | unsigned int failures; /* current failure count */ |
442 | unsigned int max_failures; /* maximum allowed failure count */ | 442 | unsigned int max_failures; /* maximum allowed failure count */ |
443 | u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ | 443 | u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ |
444 | 444 | ||
445 | u64 capacity64; /* total number of sectors */ | 445 | u64 capacity64; /* total number of sectors */ |
446 | 446 | ||
447 | int lun; /* logical unit */ | 447 | int lun; /* logical unit */ |
448 | int crc_count; /* crc counter to reduce drive speed */ | 448 | int crc_count; /* crc counter to reduce drive speed */ |
449 | #ifdef CONFIG_BLK_DEV_IDEACPI | 449 | #ifdef CONFIG_BLK_DEV_IDEACPI |
450 | struct ide_acpi_drive_link *acpidata; | 450 | struct ide_acpi_drive_link *acpidata; |
451 | #endif | 451 | #endif |
452 | struct list_head list; | 452 | struct list_head list; |
453 | struct device gendev; | 453 | struct device gendev; |
454 | struct completion gendev_rel_comp; /* to deal with device release() */ | 454 | struct completion gendev_rel_comp; /* to deal with device release() */ |
455 | } ide_drive_t; | 455 | } ide_drive_t; |
456 | 456 | ||
457 | #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) | 457 | #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) |
458 | 458 | ||
459 | #define IDE_CHIPSET_PCI_MASK \ | 459 | #define IDE_CHIPSET_PCI_MASK \ |
460 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) | 460 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) |
461 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) | 461 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) |
462 | 462 | ||
463 | struct ide_port_info; | 463 | struct ide_port_info; |
464 | 464 | ||
465 | typedef struct hwif_s { | 465 | typedef struct hwif_s { |
466 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ | 466 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ |
467 | struct hwif_s *mate; /* other hwif from same PCI chip */ | 467 | struct hwif_s *mate; /* other hwif from same PCI chip */ |
468 | struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ | 468 | struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ |
469 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 469 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
470 | 470 | ||
471 | char name[6]; /* name of interface, eg. "ide0" */ | 471 | char name[6]; /* name of interface, eg. "ide0" */ |
472 | 472 | ||
473 | /* task file registers for pata and sata */ | 473 | /* task file registers for pata and sata */ |
474 | unsigned long io_ports[IDE_NR_PORTS]; | 474 | unsigned long io_ports[IDE_NR_PORTS]; |
475 | unsigned long sata_scr[SATA_NR_PORTS]; | 475 | unsigned long sata_scr[SATA_NR_PORTS]; |
476 | unsigned long sata_misc[SATA_NR_PORTS]; | 476 | unsigned long sata_misc[SATA_NR_PORTS]; |
477 | 477 | ||
478 | ide_drive_t drives[MAX_DRIVES]; /* drive info */ | 478 | ide_drive_t drives[MAX_DRIVES]; /* drive info */ |
479 | 479 | ||
480 | u8 major; /* our major number */ | 480 | u8 major; /* our major number */ |
481 | u8 index; /* 0 for ide0; 1 for ide1; ... */ | 481 | u8 index; /* 0 for ide0; 1 for ide1; ... */ |
482 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ | 482 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ |
483 | u8 bus_state; /* power state of the IDE bus */ | 483 | u8 bus_state; /* power state of the IDE bus */ |
484 | 484 | ||
485 | u32 host_flags; | 485 | u32 host_flags; |
486 | 486 | ||
487 | u8 pio_mask; | 487 | u8 pio_mask; |
488 | 488 | ||
489 | u8 ultra_mask; | 489 | u8 ultra_mask; |
490 | u8 mwdma_mask; | 490 | u8 mwdma_mask; |
491 | u8 swdma_mask; | 491 | u8 swdma_mask; |
492 | 492 | ||
493 | u8 cbl; /* cable type */ | 493 | u8 cbl; /* cable type */ |
494 | 494 | ||
495 | hwif_chipset_t chipset; /* sub-module for tuning.. */ | 495 | hwif_chipset_t chipset; /* sub-module for tuning.. */ |
496 | 496 | ||
497 | struct device *dev; | 497 | struct device *dev; |
498 | 498 | ||
499 | const struct ide_port_info *cds; /* chipset device struct */ | 499 | const struct ide_port_info *cds; /* chipset device struct */ |
500 | 500 | ||
501 | ide_ack_intr_t *ack_intr; | 501 | ide_ack_intr_t *ack_intr; |
502 | 502 | ||
503 | void (*rw_disk)(ide_drive_t *, struct request *); | 503 | void (*rw_disk)(ide_drive_t *, struct request *); |
504 | 504 | ||
505 | #if 0 | 505 | #if 0 |
506 | ide_hwif_ops_t *hwifops; | 506 | ide_hwif_ops_t *hwifops; |
507 | #else | 507 | #else |
508 | /* host specific initialization of devices on a port */ | 508 | /* host specific initialization of devices on a port */ |
509 | void (*port_init_devs)(struct hwif_s *); | 509 | void (*port_init_devs)(struct hwif_s *); |
510 | /* routine to program host for PIO mode */ | 510 | /* routine to program host for PIO mode */ |
511 | void (*set_pio_mode)(ide_drive_t *, const u8); | 511 | void (*set_pio_mode)(ide_drive_t *, const u8); |
512 | /* routine to program host for DMA mode */ | 512 | /* routine to program host for DMA mode */ |
513 | void (*set_dma_mode)(ide_drive_t *, const u8); | 513 | void (*set_dma_mode)(ide_drive_t *, const u8); |
514 | /* tweaks hardware to select drive */ | 514 | /* tweaks hardware to select drive */ |
515 | void (*selectproc)(ide_drive_t *); | 515 | void (*selectproc)(ide_drive_t *); |
516 | /* chipset polling based on hba specifics */ | 516 | /* chipset polling based on hba specifics */ |
517 | int (*reset_poll)(ide_drive_t *); | 517 | int (*reset_poll)(ide_drive_t *); |
518 | /* chipset specific changes to default for device-hba resets */ | 518 | /* chipset specific changes to default for device-hba resets */ |
519 | void (*pre_reset)(ide_drive_t *); | 519 | void (*pre_reset)(ide_drive_t *); |
520 | /* routine to reset controller after a disk reset */ | 520 | /* routine to reset controller after a disk reset */ |
521 | void (*resetproc)(ide_drive_t *); | 521 | void (*resetproc)(ide_drive_t *); |
522 | /* special host masking for drive selection */ | 522 | /* special host masking for drive selection */ |
523 | void (*maskproc)(ide_drive_t *, int); | 523 | void (*maskproc)(ide_drive_t *, int); |
524 | /* check host's drive quirk list */ | 524 | /* check host's drive quirk list */ |
525 | void (*quirkproc)(ide_drive_t *); | 525 | void (*quirkproc)(ide_drive_t *); |
526 | /* driver soft-power interface */ | 526 | /* driver soft-power interface */ |
527 | int (*busproc)(ide_drive_t *, int); | 527 | int (*busproc)(ide_drive_t *, int); |
528 | #endif | 528 | #endif |
529 | u8 (*mdma_filter)(ide_drive_t *); | 529 | u8 (*mdma_filter)(ide_drive_t *); |
530 | u8 (*udma_filter)(ide_drive_t *); | 530 | u8 (*udma_filter)(ide_drive_t *); |
531 | 531 | ||
532 | u8 (*cable_detect)(struct hwif_s *); | 532 | u8 (*cable_detect)(struct hwif_s *); |
533 | 533 | ||
534 | void (*ata_input_data)(ide_drive_t *, void *, u32); | 534 | void (*ata_input_data)(ide_drive_t *, void *, u32); |
535 | void (*ata_output_data)(ide_drive_t *, void *, u32); | 535 | void (*ata_output_data)(ide_drive_t *, void *, u32); |
536 | 536 | ||
537 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); | 537 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); |
538 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); | 538 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); |
539 | 539 | ||
540 | void (*dma_host_set)(ide_drive_t *, int); | 540 | void (*dma_host_set)(ide_drive_t *, int); |
541 | int (*dma_setup)(ide_drive_t *); | 541 | int (*dma_setup)(ide_drive_t *); |
542 | void (*dma_exec_cmd)(ide_drive_t *, u8); | 542 | void (*dma_exec_cmd)(ide_drive_t *, u8); |
543 | void (*dma_start)(ide_drive_t *); | 543 | void (*dma_start)(ide_drive_t *); |
544 | int (*ide_dma_end)(ide_drive_t *drive); | 544 | int (*ide_dma_end)(ide_drive_t *drive); |
545 | int (*ide_dma_test_irq)(ide_drive_t *drive); | 545 | int (*ide_dma_test_irq)(ide_drive_t *drive); |
546 | void (*ide_dma_clear_irq)(ide_drive_t *drive); | 546 | void (*ide_dma_clear_irq)(ide_drive_t *drive); |
547 | void (*dma_lost_irq)(ide_drive_t *drive); | 547 | void (*dma_lost_irq)(ide_drive_t *drive); |
548 | void (*dma_timeout)(ide_drive_t *drive); | 548 | void (*dma_timeout)(ide_drive_t *drive); |
549 | 549 | ||
550 | void (*OUTB)(u8 addr, unsigned long port); | 550 | void (*OUTB)(u8 addr, unsigned long port); |
551 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); | 551 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); |
552 | void (*OUTW)(u16 addr, unsigned long port); | 552 | void (*OUTW)(u16 addr, unsigned long port); |
553 | void (*OUTSW)(unsigned long port, void *addr, u32 count); | 553 | void (*OUTSW)(unsigned long port, void *addr, u32 count); |
554 | void (*OUTSL)(unsigned long port, void *addr, u32 count); | 554 | void (*OUTSL)(unsigned long port, void *addr, u32 count); |
555 | 555 | ||
556 | u8 (*INB)(unsigned long port); | 556 | u8 (*INB)(unsigned long port); |
557 | u16 (*INW)(unsigned long port); | 557 | u16 (*INW)(unsigned long port); |
558 | void (*INSW)(unsigned long port, void *addr, u32 count); | 558 | void (*INSW)(unsigned long port, void *addr, u32 count); |
559 | void (*INSL)(unsigned long port, void *addr, u32 count); | 559 | void (*INSL)(unsigned long port, void *addr, u32 count); |
560 | 560 | ||
561 | /* dma physical region descriptor table (cpu view) */ | 561 | /* dma physical region descriptor table (cpu view) */ |
562 | unsigned int *dmatable_cpu; | 562 | unsigned int *dmatable_cpu; |
563 | /* dma physical region descriptor table (dma view) */ | 563 | /* dma physical region descriptor table (dma view) */ |
564 | dma_addr_t dmatable_dma; | 564 | dma_addr_t dmatable_dma; |
565 | /* Scatter-gather list used to build the above */ | 565 | /* Scatter-gather list used to build the above */ |
566 | struct scatterlist *sg_table; | 566 | struct scatterlist *sg_table; |
567 | int sg_max_nents; /* Maximum number of entries in it */ | 567 | int sg_max_nents; /* Maximum number of entries in it */ |
568 | int sg_nents; /* Current number of entries in it */ | 568 | int sg_nents; /* Current number of entries in it */ |
569 | int sg_dma_direction; /* dma transfer direction */ | 569 | int sg_dma_direction; /* dma transfer direction */ |
570 | 570 | ||
571 | /* data phase of the active command (currently only valid for PIO/DMA) */ | 571 | /* data phase of the active command (currently only valid for PIO/DMA) */ |
572 | int data_phase; | 572 | int data_phase; |
573 | 573 | ||
574 | unsigned int nsect; | 574 | unsigned int nsect; |
575 | unsigned int nleft; | 575 | unsigned int nleft; |
576 | struct scatterlist *cursg; | 576 | struct scatterlist *cursg; |
577 | unsigned int cursg_ofs; | 577 | unsigned int cursg_ofs; |
578 | 578 | ||
579 | int rqsize; /* max sectors per request */ | 579 | int rqsize; /* max sectors per request */ |
580 | int irq; /* our irq number */ | 580 | int irq; /* our irq number */ |
581 | 581 | ||
582 | unsigned long dma_base; /* base addr for dma ports */ | 582 | unsigned long dma_base; /* base addr for dma ports */ |
583 | unsigned long dma_command; /* dma command register */ | 583 | unsigned long dma_command; /* dma command register */ |
584 | unsigned long dma_vendor1; /* dma vendor 1 register */ | 584 | unsigned long dma_vendor1; /* dma vendor 1 register */ |
585 | unsigned long dma_status; /* dma status register */ | 585 | unsigned long dma_status; /* dma status register */ |
586 | unsigned long dma_vendor3; /* dma vendor 3 register */ | 586 | unsigned long dma_vendor3; /* dma vendor 3 register */ |
587 | unsigned long dma_prdtable; /* actual prd table address */ | 587 | unsigned long dma_prdtable; /* actual prd table address */ |
588 | 588 | ||
589 | unsigned long config_data; /* for use by chipset-specific code */ | 589 | unsigned long config_data; /* for use by chipset-specific code */ |
590 | unsigned long select_data; /* for use by chipset-specific code */ | 590 | unsigned long select_data; /* for use by chipset-specific code */ |
591 | 591 | ||
592 | unsigned long extra_base; /* extra addr for dma ports */ | 592 | unsigned long extra_base; /* extra addr for dma ports */ |
593 | unsigned extra_ports; /* number of extra dma ports */ | 593 | unsigned extra_ports; /* number of extra dma ports */ |
594 | 594 | ||
595 | unsigned noprobe : 1; /* don't probe for this interface */ | 595 | unsigned noprobe : 1; /* don't probe for this interface */ |
596 | unsigned present : 1; /* this interface exists */ | 596 | unsigned present : 1; /* this interface exists */ |
597 | unsigned hold : 1; /* this interface is always present */ | 597 | unsigned hold : 1; /* this interface is always present */ |
598 | unsigned serialized : 1; /* serialized all channel operation */ | 598 | unsigned serialized : 1; /* serialized all channel operation */ |
599 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 599 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
600 | unsigned reset : 1; /* reset after probe */ | 600 | unsigned reset : 1; /* reset after probe */ |
601 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ | 601 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ |
602 | unsigned mmio : 1; /* host uses MMIO */ | 602 | unsigned mmio : 1; /* host uses MMIO */ |
603 | unsigned straight8 : 1; /* Alan's straight 8 check */ | 603 | unsigned straight8 : 1; /* Alan's straight 8 check */ |
604 | 604 | ||
605 | struct device gendev; | 605 | struct device gendev; |
606 | struct completion gendev_rel_comp; /* To deal with device release() */ | 606 | struct completion gendev_rel_comp; /* To deal with device release() */ |
607 | 607 | ||
608 | void *hwif_data; /* extra hwif data */ | 608 | void *hwif_data; /* extra hwif data */ |
609 | 609 | ||
610 | unsigned dma; | 610 | unsigned dma; |
611 | 611 | ||
612 | #ifdef CONFIG_BLK_DEV_IDEACPI | 612 | #ifdef CONFIG_BLK_DEV_IDEACPI |
613 | struct ide_acpi_hwif_link *acpidata; | 613 | struct ide_acpi_hwif_link *acpidata; |
614 | #endif | 614 | #endif |
615 | } ____cacheline_internodealigned_in_smp ide_hwif_t; | 615 | } ____cacheline_internodealigned_in_smp ide_hwif_t; |
616 | 616 | ||
617 | /* | 617 | /* |
618 | * internal ide interrupt handler type | 618 | * internal ide interrupt handler type |
619 | */ | 619 | */ |
620 | typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); | 620 | typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); |
621 | typedef int (ide_expiry_t)(ide_drive_t *); | 621 | typedef int (ide_expiry_t)(ide_drive_t *); |
622 | 622 | ||
623 | /* used by ide-cd, ide-floppy, etc. */ | 623 | /* used by ide-cd, ide-floppy, etc. */ |
624 | typedef void (xfer_func_t)(ide_drive_t *, void *, u32); | 624 | typedef void (xfer_func_t)(ide_drive_t *, void *, u32); |
625 | 625 | ||
626 | typedef struct hwgroup_s { | 626 | typedef struct hwgroup_s { |
627 | /* irq handler, if active */ | 627 | /* irq handler, if active */ |
628 | ide_startstop_t (*handler)(ide_drive_t *); | 628 | ide_startstop_t (*handler)(ide_drive_t *); |
629 | 629 | ||
630 | /* BOOL: protects all fields below */ | 630 | /* BOOL: protects all fields below */ |
631 | volatile int busy; | 631 | volatile int busy; |
632 | /* BOOL: wake us up on timer expiry */ | 632 | /* BOOL: wake us up on timer expiry */ |
633 | unsigned int sleeping : 1; | 633 | unsigned int sleeping : 1; |
634 | /* BOOL: polling active & poll_timeout field valid */ | 634 | /* BOOL: polling active & poll_timeout field valid */ |
635 | unsigned int polling : 1; | 635 | unsigned int polling : 1; |
636 | /* BOOL: in a polling reset situation. Must not trigger another reset yet */ | 636 | /* BOOL: in a polling reset situation. Must not trigger another reset yet */ |
637 | unsigned int resetting : 1; | 637 | unsigned int resetting : 1; |
638 | 638 | ||
639 | /* current drive */ | 639 | /* current drive */ |
640 | ide_drive_t *drive; | 640 | ide_drive_t *drive; |
641 | /* ptr to current hwif in linked-list */ | 641 | /* ptr to current hwif in linked-list */ |
642 | ide_hwif_t *hwif; | 642 | ide_hwif_t *hwif; |
643 | 643 | ||
644 | /* current request */ | 644 | /* current request */ |
645 | struct request *rq; | 645 | struct request *rq; |
646 | 646 | ||
647 | /* failsafe timer */ | 647 | /* failsafe timer */ |
648 | struct timer_list timer; | 648 | struct timer_list timer; |
649 | /* timeout value during long polls */ | 649 | /* timeout value during long polls */ |
650 | unsigned long poll_timeout; | 650 | unsigned long poll_timeout; |
651 | /* queried upon timeouts */ | 651 | /* queried upon timeouts */ |
652 | int (*expiry)(ide_drive_t *); | 652 | int (*expiry)(ide_drive_t *); |
653 | 653 | ||
654 | int req_gen; | 654 | int req_gen; |
655 | int req_gen_timer; | 655 | int req_gen_timer; |
656 | } ide_hwgroup_t; | 656 | } ide_hwgroup_t; |
657 | 657 | ||
658 | typedef struct ide_driver_s ide_driver_t; | 658 | typedef struct ide_driver_s ide_driver_t; |
659 | 659 | ||
660 | extern struct mutex ide_setting_mtx; | 660 | extern struct mutex ide_setting_mtx; |
661 | 661 | ||
662 | int set_io_32bit(ide_drive_t *, int); | 662 | int set_io_32bit(ide_drive_t *, int); |
663 | int set_pio_mode(ide_drive_t *, int); | 663 | int set_pio_mode(ide_drive_t *, int); |
664 | int set_using_dma(ide_drive_t *, int); | 664 | int set_using_dma(ide_drive_t *, int); |
665 | 665 | ||
666 | #ifdef CONFIG_IDE_PROC_FS | 666 | #ifdef CONFIG_IDE_PROC_FS |
667 | /* | 667 | /* |
668 | * configurable drive settings | 668 | * configurable drive settings |
669 | */ | 669 | */ |
670 | 670 | ||
671 | #define TYPE_INT 0 | 671 | #define TYPE_INT 0 |
672 | #define TYPE_BYTE 1 | 672 | #define TYPE_BYTE 1 |
673 | #define TYPE_SHORT 2 | 673 | #define TYPE_SHORT 2 |
674 | 674 | ||
675 | #define SETTING_READ (1 << 0) | 675 | #define SETTING_READ (1 << 0) |
676 | #define SETTING_WRITE (1 << 1) | 676 | #define SETTING_WRITE (1 << 1) |
677 | #define SETTING_RW (SETTING_READ | SETTING_WRITE) | 677 | #define SETTING_RW (SETTING_READ | SETTING_WRITE) |
678 | 678 | ||
679 | typedef int (ide_procset_t)(ide_drive_t *, int); | 679 | typedef int (ide_procset_t)(ide_drive_t *, int); |
680 | typedef struct ide_settings_s { | 680 | typedef struct ide_settings_s { |
681 | char *name; | 681 | char *name; |
682 | int rw; | 682 | int rw; |
683 | int data_type; | 683 | int data_type; |
684 | int min; | 684 | int min; |
685 | int max; | 685 | int max; |
686 | int mul_factor; | 686 | int mul_factor; |
687 | int div_factor; | 687 | int div_factor; |
688 | void *data; | 688 | void *data; |
689 | ide_procset_t *set; | 689 | ide_procset_t *set; |
690 | int auto_remove; | 690 | int auto_remove; |
691 | struct ide_settings_s *next; | 691 | struct ide_settings_s *next; |
692 | } ide_settings_t; | 692 | } ide_settings_t; |
693 | 693 | ||
694 | int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set); | 694 | int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set); |
695 | 695 | ||
696 | /* | 696 | /* |
697 | * /proc/ide interface | 697 | * /proc/ide interface |
698 | */ | 698 | */ |
699 | typedef struct { | 699 | typedef struct { |
700 | const char *name; | 700 | const char *name; |
701 | mode_t mode; | 701 | mode_t mode; |
702 | read_proc_t *read_proc; | 702 | read_proc_t *read_proc; |
703 | write_proc_t *write_proc; | 703 | write_proc_t *write_proc; |
704 | } ide_proc_entry_t; | 704 | } ide_proc_entry_t; |
705 | 705 | ||
706 | void proc_ide_create(void); | 706 | void proc_ide_create(void); |
707 | void proc_ide_destroy(void); | 707 | void proc_ide_destroy(void); |
708 | void ide_proc_register_port(ide_hwif_t *); | 708 | void ide_proc_register_port(ide_hwif_t *); |
709 | void ide_proc_port_register_devices(ide_hwif_t *); | 709 | void ide_proc_port_register_devices(ide_hwif_t *); |
710 | void ide_proc_unregister_port(ide_hwif_t *); | 710 | void ide_proc_unregister_port(ide_hwif_t *); |
711 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); | 711 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); |
712 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); | 712 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); |
713 | 713 | ||
714 | void ide_add_generic_settings(ide_drive_t *); | 714 | void ide_add_generic_settings(ide_drive_t *); |
715 | 715 | ||
716 | read_proc_t proc_ide_read_capacity; | 716 | read_proc_t proc_ide_read_capacity; |
717 | read_proc_t proc_ide_read_geometry; | 717 | read_proc_t proc_ide_read_geometry; |
718 | 718 | ||
719 | #ifdef CONFIG_BLK_DEV_IDEPCI | 719 | #ifdef CONFIG_BLK_DEV_IDEPCI |
720 | void ide_pci_create_host_proc(const char *, get_info_t *); | 720 | void ide_pci_create_host_proc(const char *, get_info_t *); |
721 | #endif | 721 | #endif |
722 | 722 | ||
723 | /* | 723 | /* |
724 | * Standard exit stuff: | 724 | * Standard exit stuff: |
725 | */ | 725 | */ |
726 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) \ | 726 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) \ |
727 | { \ | 727 | { \ |
728 | len -= off; \ | 728 | len -= off; \ |
729 | if (len < count) { \ | 729 | if (len < count) { \ |
730 | *eof = 1; \ | 730 | *eof = 1; \ |
731 | if (len <= 0) \ | 731 | if (len <= 0) \ |
732 | return 0; \ | 732 | return 0; \ |
733 | } else \ | 733 | } else \ |
734 | len = count; \ | 734 | len = count; \ |
735 | *start = page + off; \ | 735 | *start = page + off; \ |
736 | return len; \ | 736 | return len; \ |
737 | } | 737 | } |
738 | #else | 738 | #else |
739 | static inline void proc_ide_create(void) { ; } | 739 | static inline void proc_ide_create(void) { ; } |
740 | static inline void proc_ide_destroy(void) { ; } | 740 | static inline void proc_ide_destroy(void) { ; } |
741 | static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } | 741 | static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } |
742 | static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } | 742 | static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } |
743 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } | 743 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } |
744 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 744 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
745 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 745 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
746 | static inline void ide_add_generic_settings(ide_drive_t *drive) { ; } | 746 | static inline void ide_add_generic_settings(ide_drive_t *drive) { ; } |
747 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; | 747 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; |
748 | #endif | 748 | #endif |
749 | 749 | ||
750 | /* | 750 | /* |
751 | * Power Management step value (rq->pm->pm_step). | 751 | * Power Management step value (rq->pm->pm_step). |
752 | * | 752 | * |
753 | * The step value starts at 0 (ide_pm_state_start_suspend) for a | 753 | * The step value starts at 0 (ide_pm_state_start_suspend) for a |
754 | * suspend operation or 1000 (ide_pm_state_start_resume) for a | 754 | * suspend operation or 1000 (ide_pm_state_start_resume) for a |
755 | * resume operation. | 755 | * resume operation. |
756 | * | 756 | * |
757 | * For each step, the core calls the subdriver start_power_step() first. | 757 | * For each step, the core calls the subdriver start_power_step() first. |
758 | * This can return: | 758 | * This can return: |
759 | * - ide_stopped : In this case, the core calls us back again unless | 759 | * - ide_stopped : In this case, the core calls us back again unless |
760 | * step have been set to ide_power_state_completed. | 760 | * step have been set to ide_power_state_completed. |
761 | * - ide_started : In this case, the channel is left busy until an | 761 | * - ide_started : In this case, the channel is left busy until an |
762 | * async event (interrupt) occurs. | 762 | * async event (interrupt) occurs. |
763 | * Typically, start_power_step() will issue a taskfile request with | 763 | * Typically, start_power_step() will issue a taskfile request with |
764 | * do_rw_taskfile(). | 764 | * do_rw_taskfile(). |
765 | * | 765 | * |
766 | * Upon reception of the interrupt, the core will call complete_power_step() | 766 | * Upon reception of the interrupt, the core will call complete_power_step() |
767 | * with the error code if any. This routine should update the step value | 767 | * with the error code if any. This routine should update the step value |
768 | * and return. It should not start a new request. The core will call | 768 | * and return. It should not start a new request. The core will call |
769 | * start_power_step for the new step value, unless step have been set to | 769 | * start_power_step for the new step value, unless step have been set to |
770 | * ide_power_state_completed. | 770 | * ide_power_state_completed. |
771 | * | 771 | * |
772 | * Subdrivers are expected to define their own additional power | 772 | * Subdrivers are expected to define their own additional power |
773 | * steps from 1..999 for suspend and from 1001..1999 for resume, | 773 | * steps from 1..999 for suspend and from 1001..1999 for resume, |
774 | * other values are reserved for future use. | 774 | * other values are reserved for future use. |
775 | */ | 775 | */ |
776 | 776 | ||
777 | enum { | 777 | enum { |
778 | ide_pm_state_completed = -1, | 778 | ide_pm_state_completed = -1, |
779 | ide_pm_state_start_suspend = 0, | 779 | ide_pm_state_start_suspend = 0, |
780 | ide_pm_state_start_resume = 1000, | 780 | ide_pm_state_start_resume = 1000, |
781 | }; | 781 | }; |
782 | 782 | ||
783 | /* | 783 | /* |
784 | * Subdrivers support. | 784 | * Subdrivers support. |
785 | * | 785 | * |
786 | * The gendriver.owner field should be set to the module owner of this driver. | 786 | * The gendriver.owner field should be set to the module owner of this driver. |
787 | * The gendriver.name field should be set to the name of this driver | 787 | * The gendriver.name field should be set to the name of this driver |
788 | */ | 788 | */ |
789 | struct ide_driver_s { | 789 | struct ide_driver_s { |
790 | const char *version; | 790 | const char *version; |
791 | u8 media; | 791 | u8 media; |
792 | unsigned supports_dsc_overlap : 1; | 792 | unsigned supports_dsc_overlap : 1; |
793 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 793 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
794 | int (*end_request)(ide_drive_t *, int, int); | 794 | int (*end_request)(ide_drive_t *, int, int); |
795 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); | 795 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); |
796 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); | 796 | ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); |
797 | struct device_driver gen_driver; | 797 | struct device_driver gen_driver; |
798 | int (*probe)(ide_drive_t *); | 798 | int (*probe)(ide_drive_t *); |
799 | void (*remove)(ide_drive_t *); | 799 | void (*remove)(ide_drive_t *); |
800 | void (*resume)(ide_drive_t *); | 800 | void (*resume)(ide_drive_t *); |
801 | void (*shutdown)(ide_drive_t *); | 801 | void (*shutdown)(ide_drive_t *); |
802 | #ifdef CONFIG_IDE_PROC_FS | 802 | #ifdef CONFIG_IDE_PROC_FS |
803 | ide_proc_entry_t *proc; | 803 | ide_proc_entry_t *proc; |
804 | #endif | 804 | #endif |
805 | }; | 805 | }; |
806 | 806 | ||
807 | #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) | 807 | #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) |
808 | 808 | ||
809 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); | 809 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); |
810 | 810 | ||
811 | /* | 811 | /* |
812 | * ide_hwifs[] is the master data structure used to keep track | 812 | * ide_hwifs[] is the master data structure used to keep track |
813 | * of just about everything in ide.c. Whenever possible, routines | 813 | * of just about everything in ide.c. Whenever possible, routines |
814 | * should be using pointers to a drive (ide_drive_t *) or | 814 | * should be using pointers to a drive (ide_drive_t *) or |
815 | * pointers to a hwif (ide_hwif_t *), rather than indexing this | 815 | * pointers to a hwif (ide_hwif_t *), rather than indexing this |
816 | * structure directly (the allocation/layout may change!). | 816 | * structure directly (the allocation/layout may change!). |
817 | * | 817 | * |
818 | */ | 818 | */ |
819 | #ifndef _IDE_C | 819 | #ifndef _IDE_C |
820 | extern ide_hwif_t ide_hwifs[]; /* master data repository */ | 820 | extern ide_hwif_t ide_hwifs[]; /* master data repository */ |
821 | #endif | 821 | #endif |
822 | extern int noautodma; | 822 | extern int noautodma; |
823 | 823 | ||
824 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); | 824 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); |
825 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | 825 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, |
826 | int uptodate, int nr_sectors); | 826 | int uptodate, int nr_sectors); |
827 | 827 | ||
828 | extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); | 828 | extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); |
829 | 829 | ||
830 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, | 830 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, |
831 | ide_expiry_t *); | 831 | ide_expiry_t *); |
832 | 832 | ||
833 | ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); | 833 | ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); |
834 | 834 | ||
835 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); | 835 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
836 | 836 | ||
837 | ide_startstop_t __ide_abort(ide_drive_t *, struct request *); | 837 | ide_startstop_t __ide_abort(ide_drive_t *, struct request *); |
838 | 838 | ||
839 | extern ide_startstop_t ide_abort(ide_drive_t *, const char *); | 839 | extern ide_startstop_t ide_abort(ide_drive_t *, const char *); |
840 | 840 | ||
841 | extern void ide_fix_driveid(struct hd_driveid *); | 841 | extern void ide_fix_driveid(struct hd_driveid *); |
842 | 842 | ||
843 | extern void ide_fixstring(u8 *, const int, const int); | 843 | extern void ide_fixstring(u8 *, const int, const int); |
844 | 844 | ||
845 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | 845 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); |
846 | 846 | ||
847 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 847 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
848 | 848 | ||
849 | extern void ide_init_drive_cmd (struct request *rq); | 849 | extern void ide_init_drive_cmd (struct request *rq); |
850 | 850 | ||
851 | /* | 851 | /* |
852 | * "action" parameter type for ide_do_drive_cmd() below. | 852 | * "action" parameter type for ide_do_drive_cmd() below. |
853 | */ | 853 | */ |
854 | typedef enum { | 854 | typedef enum { |
855 | ide_wait, /* insert rq at end of list, and wait for it */ | 855 | ide_wait, /* insert rq at end of list, and wait for it */ |
856 | ide_preempt, /* insert rq in front of current request */ | 856 | ide_preempt, /* insert rq in front of current request */ |
857 | ide_head_wait, /* insert rq in front of current request and wait for it */ | 857 | ide_head_wait, /* insert rq in front of current request and wait for it */ |
858 | ide_end /* insert rq at end of list, but don't wait for it */ | 858 | ide_end /* insert rq at end of list, but don't wait for it */ |
859 | } ide_action_t; | 859 | } ide_action_t; |
860 | 860 | ||
861 | extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); | 861 | extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); |
862 | 862 | ||
863 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 863 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); |
864 | 864 | ||
865 | enum { | 865 | enum { |
866 | IDE_TFLAG_LBA48 = (1 << 0), | 866 | IDE_TFLAG_LBA48 = (1 << 0), |
867 | IDE_TFLAG_NO_SELECT_MASK = (1 << 1), | 867 | IDE_TFLAG_NO_SELECT_MASK = (1 << 1), |
868 | IDE_TFLAG_FLAGGED = (1 << 2), | 868 | IDE_TFLAG_FLAGGED = (1 << 2), |
869 | IDE_TFLAG_OUT_DATA = (1 << 3), | 869 | IDE_TFLAG_OUT_DATA = (1 << 3), |
870 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | 870 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), |
871 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), | 871 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), |
872 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), | 872 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), |
873 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 7), | 873 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 7), |
874 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 8), | 874 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 8), |
875 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | | 875 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | |
876 | IDE_TFLAG_OUT_HOB_NSECT | | 876 | IDE_TFLAG_OUT_HOB_NSECT | |
877 | IDE_TFLAG_OUT_HOB_LBAL | | 877 | IDE_TFLAG_OUT_HOB_LBAL | |
878 | IDE_TFLAG_OUT_HOB_LBAM | | 878 | IDE_TFLAG_OUT_HOB_LBAM | |
879 | IDE_TFLAG_OUT_HOB_LBAH, | 879 | IDE_TFLAG_OUT_HOB_LBAH, |
880 | IDE_TFLAG_OUT_FEATURE = (1 << 9), | 880 | IDE_TFLAG_OUT_FEATURE = (1 << 9), |
881 | IDE_TFLAG_OUT_NSECT = (1 << 10), | 881 | IDE_TFLAG_OUT_NSECT = (1 << 10), |
882 | IDE_TFLAG_OUT_LBAL = (1 << 11), | 882 | IDE_TFLAG_OUT_LBAL = (1 << 11), |
883 | IDE_TFLAG_OUT_LBAM = (1 << 12), | 883 | IDE_TFLAG_OUT_LBAM = (1 << 12), |
884 | IDE_TFLAG_OUT_LBAH = (1 << 13), | 884 | IDE_TFLAG_OUT_LBAH = (1 << 13), |
885 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | 885 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | |
886 | IDE_TFLAG_OUT_NSECT | | 886 | IDE_TFLAG_OUT_NSECT | |
887 | IDE_TFLAG_OUT_LBAL | | 887 | IDE_TFLAG_OUT_LBAL | |
888 | IDE_TFLAG_OUT_LBAM | | 888 | IDE_TFLAG_OUT_LBAM | |
889 | IDE_TFLAG_OUT_LBAH, | 889 | IDE_TFLAG_OUT_LBAH, |
890 | IDE_TFLAG_OUT_DEVICE = (1 << 14), | 890 | IDE_TFLAG_OUT_DEVICE = (1 << 14), |
891 | IDE_TFLAG_WRITE = (1 << 15), | 891 | IDE_TFLAG_WRITE = (1 << 15), |
892 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), | 892 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), |
893 | IDE_TFLAG_IN_DATA = (1 << 17), | 893 | IDE_TFLAG_IN_DATA = (1 << 17), |
894 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), | 894 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), |
895 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), | 895 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), |
896 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), | 896 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), |
897 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), | 897 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), |
898 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), | 898 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), |
899 | IDE_TFLAG_IN_HOB_LBAM = (1 << 23), | 899 | IDE_TFLAG_IN_HOB_LBAM = (1 << 23), |
900 | IDE_TFLAG_IN_HOB_LBAH = (1 << 24), | 900 | IDE_TFLAG_IN_HOB_LBAH = (1 << 24), |
901 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | | 901 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | |
902 | IDE_TFLAG_IN_HOB_LBAM | | 902 | IDE_TFLAG_IN_HOB_LBAM | |
903 | IDE_TFLAG_IN_HOB_LBAH, | 903 | IDE_TFLAG_IN_HOB_LBAH, |
904 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | 904 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | |
905 | IDE_TFLAG_IN_HOB_NSECT | | 905 | IDE_TFLAG_IN_HOB_NSECT | |
906 | IDE_TFLAG_IN_HOB_LBA, | 906 | IDE_TFLAG_IN_HOB_LBA, |
907 | IDE_TFLAG_IN_NSECT = (1 << 25), | 907 | IDE_TFLAG_IN_NSECT = (1 << 25), |
908 | IDE_TFLAG_IN_LBAL = (1 << 26), | 908 | IDE_TFLAG_IN_LBAL = (1 << 26), |
909 | IDE_TFLAG_IN_LBAM = (1 << 27), | 909 | IDE_TFLAG_IN_LBAM = (1 << 27), |
910 | IDE_TFLAG_IN_LBAH = (1 << 28), | 910 | IDE_TFLAG_IN_LBAH = (1 << 28), |
911 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | 911 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | |
912 | IDE_TFLAG_IN_LBAM | | 912 | IDE_TFLAG_IN_LBAM | |
913 | IDE_TFLAG_IN_LBAH, | 913 | IDE_TFLAG_IN_LBAH, |
914 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | 914 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | |
915 | IDE_TFLAG_IN_LBA, | 915 | IDE_TFLAG_IN_LBA, |
916 | IDE_TFLAG_IN_DEVICE = (1 << 29), | 916 | IDE_TFLAG_IN_DEVICE = (1 << 29), |
917 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | 917 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | |
918 | IDE_TFLAG_IN_HOB, | 918 | IDE_TFLAG_IN_HOB, |
919 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | 919 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | |
920 | IDE_TFLAG_IN_TF, | 920 | IDE_TFLAG_IN_TF, |
921 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | 921 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | |
922 | IDE_TFLAG_IN_DEVICE, | 922 | IDE_TFLAG_IN_DEVICE, |
923 | /* force 16-bit I/O operations */ | 923 | /* force 16-bit I/O operations */ |
924 | IDE_TFLAG_IO_16BIT = (1 << 30), | 924 | IDE_TFLAG_IO_16BIT = (1 << 30), |
925 | }; | 925 | }; |
926 | 926 | ||
927 | struct ide_taskfile { | 927 | struct ide_taskfile { |
928 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ | 928 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ |
929 | 929 | ||
930 | u8 hob_feature; /* 1-5: additional data to support LBA48 */ | 930 | u8 hob_feature; /* 1-5: additional data to support LBA48 */ |
931 | u8 hob_nsect; | 931 | u8 hob_nsect; |
932 | u8 hob_lbal; | 932 | u8 hob_lbal; |
933 | u8 hob_lbam; | 933 | u8 hob_lbam; |
934 | u8 hob_lbah; | 934 | u8 hob_lbah; |
935 | 935 | ||
936 | u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ | 936 | u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ |
937 | 937 | ||
938 | union { /* ย 7: */ | 938 | union { /* ย 7: */ |
939 | u8 error; /* read: error */ | 939 | u8 error; /* read: error */ |
940 | u8 feature; /* write: feature */ | 940 | u8 feature; /* write: feature */ |
941 | }; | 941 | }; |
942 | 942 | ||
943 | u8 nsect; /* 8: number of sectors */ | 943 | u8 nsect; /* 8: number of sectors */ |
944 | u8 lbal; /* 9: LBA low */ | 944 | u8 lbal; /* 9: LBA low */ |
945 | u8 lbam; /* 10: LBA mid */ | 945 | u8 lbam; /* 10: LBA mid */ |
946 | u8 lbah; /* 11: LBA high */ | 946 | u8 lbah; /* 11: LBA high */ |
947 | 947 | ||
948 | u8 device; /* 12: device select */ | 948 | u8 device; /* 12: device select */ |
949 | 949 | ||
950 | union { /* 13: */ | 950 | union { /* 13: */ |
951 | u8 status; /* ย read: status ย */ | 951 | u8 status; /* ย read: status ย */ |
952 | u8 command; /* write: command */ | 952 | u8 command; /* write: command */ |
953 | }; | 953 | }; |
954 | }; | 954 | }; |
955 | 955 | ||
956 | typedef struct ide_task_s { | 956 | typedef struct ide_task_s { |
957 | union { | 957 | union { |
958 | struct ide_taskfile tf; | 958 | struct ide_taskfile tf; |
959 | u8 tf_array[14]; | 959 | u8 tf_array[14]; |
960 | }; | 960 | }; |
961 | u32 tf_flags; | 961 | u32 tf_flags; |
962 | int data_phase; | 962 | int data_phase; |
963 | struct request *rq; /* copy of request */ | 963 | struct request *rq; /* copy of request */ |
964 | void *special; /* valid_t generally */ | 964 | void *special; /* valid_t generally */ |
965 | } ide_task_t; | 965 | } ide_task_t; |
966 | 966 | ||
967 | void ide_tf_load(ide_drive_t *, ide_task_t *); | 967 | void ide_tf_load(ide_drive_t *, ide_task_t *); |
968 | void ide_tf_read(ide_drive_t *, ide_task_t *); | 968 | void ide_tf_read(ide_drive_t *, ide_task_t *); |
969 | 969 | ||
970 | extern void SELECT_DRIVE(ide_drive_t *); | 970 | extern void SELECT_DRIVE(ide_drive_t *); |
971 | extern void SELECT_MASK(ide_drive_t *, int); | 971 | extern void SELECT_MASK(ide_drive_t *, int); |
972 | 972 | ||
973 | extern int drive_is_ready(ide_drive_t *); | 973 | extern int drive_is_ready(ide_drive_t *); |
974 | 974 | ||
975 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | 975 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); |
976 | 976 | ||
977 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 977 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); |
978 | 978 | ||
979 | void task_end_request(ide_drive_t *, struct request *, u8); | 979 | void task_end_request(ide_drive_t *, struct request *, u8); |
980 | 980 | ||
981 | int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); | 981 | int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); |
982 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); | 982 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); |
983 | 983 | ||
984 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); | 984 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); |
985 | int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); | 985 | int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); |
986 | int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); | 986 | int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); |
987 | 987 | ||
988 | extern int system_bus_clock(void); | 988 | extern int system_bus_clock(void); |
989 | 989 | ||
990 | extern int ide_driveid_update(ide_drive_t *); | 990 | extern int ide_driveid_update(ide_drive_t *); |
991 | extern int ide_config_drive_speed(ide_drive_t *, u8); | 991 | extern int ide_config_drive_speed(ide_drive_t *, u8); |
992 | extern u8 eighty_ninty_three (ide_drive_t *); | 992 | extern u8 eighty_ninty_three (ide_drive_t *); |
993 | extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); | 993 | extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); |
994 | 994 | ||
995 | extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); | 995 | extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); |
996 | 996 | ||
997 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); | 997 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); |
998 | 998 | ||
999 | extern int ide_spin_wait_hwgroup(ide_drive_t *); | 999 | extern int ide_spin_wait_hwgroup(ide_drive_t *); |
1000 | extern void ide_timer_expiry(unsigned long); | 1000 | extern void ide_timer_expiry(unsigned long); |
1001 | extern irqreturn_t ide_intr(int irq, void *dev_id); | 1001 | extern irqreturn_t ide_intr(int irq, void *dev_id); |
1002 | extern void do_ide_request(struct request_queue *); | 1002 | extern void do_ide_request(struct request_queue *); |
1003 | 1003 | ||
1004 | void ide_init_disk(struct gendisk *, ide_drive_t *); | 1004 | void ide_init_disk(struct gendisk *, ide_drive_t *); |
1005 | 1005 | ||
1006 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | 1006 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER |
1007 | extern int ide_scan_direction; | 1007 | extern int ide_scan_direction; |
1008 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); | 1008 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); |
1009 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) | 1009 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) |
1010 | #else | 1010 | #else |
1011 | #define ide_pci_register_driver(d) pci_register_driver(d) | 1011 | #define ide_pci_register_driver(d) pci_register_driver(d) |
1012 | #endif | 1012 | #endif |
1013 | 1013 | ||
1014 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); | 1014 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); |
1015 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | 1015 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
1016 | 1016 | ||
1017 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 1017 | /* FIXME: palm_bk3710 uses BLK_DEV_IDEDMA_PCI without BLK_DEV_IDEPCI! */ |
1018 | #if defined(CONFIG_BLK_DEV_IDEPCI) && defined(CONFIG_BLK_DEV_IDEDMA_PCI) | ||
1018 | void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); | 1019 | void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); |
1019 | #else | 1020 | #else |
1020 | static inline void ide_hwif_setup_dma(ide_hwif_t *hwif, | 1021 | static inline void ide_hwif_setup_dma(ide_hwif_t *hwif, |
1021 | const struct ide_port_info *d) { } | 1022 | const struct ide_port_info *d) { } |
1022 | #endif | 1023 | #endif |
1023 | 1024 | ||
1024 | extern void default_hwif_iops(ide_hwif_t *); | 1025 | extern void default_hwif_iops(ide_hwif_t *); |
1025 | extern void default_hwif_mmiops(ide_hwif_t *); | 1026 | extern void default_hwif_mmiops(ide_hwif_t *); |
1026 | extern void default_hwif_transport(ide_hwif_t *); | 1027 | extern void default_hwif_transport(ide_hwif_t *); |
1027 | 1028 | ||
1028 | typedef struct ide_pci_enablebit_s { | 1029 | typedef struct ide_pci_enablebit_s { |
1029 | u8 reg; /* byte pci reg holding the enable-bit */ | 1030 | u8 reg; /* byte pci reg holding the enable-bit */ |
1030 | u8 mask; /* mask to isolate the enable-bit */ | 1031 | u8 mask; /* mask to isolate the enable-bit */ |
1031 | u8 val; /* value of masked reg when "enabled" */ | 1032 | u8 val; /* value of masked reg when "enabled" */ |
1032 | } ide_pci_enablebit_t; | 1033 | } ide_pci_enablebit_t; |
1033 | 1034 | ||
1034 | enum { | 1035 | enum { |
1035 | /* Uses ISA control ports not PCI ones. */ | 1036 | /* Uses ISA control ports not PCI ones. */ |
1036 | IDE_HFLAG_ISA_PORTS = (1 << 0), | 1037 | IDE_HFLAG_ISA_PORTS = (1 << 0), |
1037 | /* single port device */ | 1038 | /* single port device */ |
1038 | IDE_HFLAG_SINGLE = (1 << 1), | 1039 | IDE_HFLAG_SINGLE = (1 << 1), |
1039 | /* don't use legacy PIO blacklist */ | 1040 | /* don't use legacy PIO blacklist */ |
1040 | IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), | 1041 | IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), |
1041 | /* don't use conservative PIO "downgrade" */ | 1042 | /* don't use conservative PIO "downgrade" */ |
1042 | IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), | 1043 | IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), |
1043 | /* use PIO8/9 for prefetch off/on */ | 1044 | /* use PIO8/9 for prefetch off/on */ |
1044 | IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), | 1045 | IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), |
1045 | /* use PIO6/7 for fast-devsel off/on */ | 1046 | /* use PIO6/7 for fast-devsel off/on */ |
1046 | IDE_HFLAG_ABUSE_FAST_DEVSEL = (1 << 5), | 1047 | IDE_HFLAG_ABUSE_FAST_DEVSEL = (1 << 5), |
1047 | /* use 100-102 and 200-202 PIO values to set DMA modes */ | 1048 | /* use 100-102 and 200-202 PIO values to set DMA modes */ |
1048 | IDE_HFLAG_ABUSE_DMA_MODES = (1 << 6), | 1049 | IDE_HFLAG_ABUSE_DMA_MODES = (1 << 6), |
1049 | /* | 1050 | /* |
1050 | * keep DMA setting when programming PIO mode, may be used only | 1051 | * keep DMA setting when programming PIO mode, may be used only |
1051 | * for hosts which have separate PIO and DMA timings (ie. PMAC) | 1052 | * for hosts which have separate PIO and DMA timings (ie. PMAC) |
1052 | */ | 1053 | */ |
1053 | IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = (1 << 7), | 1054 | IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = (1 << 7), |
1054 | /* program host for the transfer mode after programming device */ | 1055 | /* program host for the transfer mode after programming device */ |
1055 | IDE_HFLAG_POST_SET_MODE = (1 << 8), | 1056 | IDE_HFLAG_POST_SET_MODE = (1 << 8), |
1056 | /* don't program host/device for the transfer mode ("smart" hosts) */ | 1057 | /* don't program host/device for the transfer mode ("smart" hosts) */ |
1057 | IDE_HFLAG_NO_SET_MODE = (1 << 9), | 1058 | IDE_HFLAG_NO_SET_MODE = (1 << 9), |
1058 | /* trust BIOS for programming chipset/device for DMA */ | 1059 | /* trust BIOS for programming chipset/device for DMA */ |
1059 | IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), | 1060 | IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), |
1060 | /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */ | 1061 | /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */ |
1061 | IDE_HFLAG_VDMA = (1 << 11), | 1062 | IDE_HFLAG_VDMA = (1 << 11), |
1062 | /* ATAPI DMA is unsupported */ | 1063 | /* ATAPI DMA is unsupported */ |
1063 | IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), | 1064 | IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), |
1064 | /* set if host is a "bootable" controller */ | 1065 | /* set if host is a "bootable" controller */ |
1065 | IDE_HFLAG_BOOTABLE = (1 << 13), | 1066 | IDE_HFLAG_BOOTABLE = (1 << 13), |
1066 | /* host doesn't support DMA */ | 1067 | /* host doesn't support DMA */ |
1067 | IDE_HFLAG_NO_DMA = (1 << 14), | 1068 | IDE_HFLAG_NO_DMA = (1 << 14), |
1068 | /* check if host is PCI IDE device before allowing DMA */ | 1069 | /* check if host is PCI IDE device before allowing DMA */ |
1069 | IDE_HFLAG_NO_AUTODMA = (1 << 15), | 1070 | IDE_HFLAG_NO_AUTODMA = (1 << 15), |
1070 | /* don't autotune PIO */ | 1071 | /* don't autotune PIO */ |
1071 | IDE_HFLAG_NO_AUTOTUNE = (1 << 16), | 1072 | IDE_HFLAG_NO_AUTOTUNE = (1 << 16), |
1072 | /* host is CS5510/CS5520 */ | 1073 | /* host is CS5510/CS5520 */ |
1073 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, | 1074 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, |
1074 | /* no LBA48 */ | 1075 | /* no LBA48 */ |
1075 | IDE_HFLAG_NO_LBA48 = (1 << 17), | 1076 | IDE_HFLAG_NO_LBA48 = (1 << 17), |
1076 | /* no LBA48 DMA */ | 1077 | /* no LBA48 DMA */ |
1077 | IDE_HFLAG_NO_LBA48_DMA = (1 << 18), | 1078 | IDE_HFLAG_NO_LBA48_DMA = (1 << 18), |
1078 | /* data FIFO is cleared by an error */ | 1079 | /* data FIFO is cleared by an error */ |
1079 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), | 1080 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), |
1080 | /* serialize ports */ | 1081 | /* serialize ports */ |
1081 | IDE_HFLAG_SERIALIZE = (1 << 20), | 1082 | IDE_HFLAG_SERIALIZE = (1 << 20), |
1082 | /* use legacy IRQs */ | 1083 | /* use legacy IRQs */ |
1083 | IDE_HFLAG_LEGACY_IRQS = (1 << 21), | 1084 | IDE_HFLAG_LEGACY_IRQS = (1 << 21), |
1084 | /* force use of legacy IRQs */ | 1085 | /* force use of legacy IRQs */ |
1085 | IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), | 1086 | IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), |
1086 | /* limit LBA48 requests to 256 sectors */ | 1087 | /* limit LBA48 requests to 256 sectors */ |
1087 | IDE_HFLAG_RQSIZE_256 = (1 << 23), | 1088 | IDE_HFLAG_RQSIZE_256 = (1 << 23), |
1088 | /* use 32-bit I/O ops */ | 1089 | /* use 32-bit I/O ops */ |
1089 | IDE_HFLAG_IO_32BIT = (1 << 24), | 1090 | IDE_HFLAG_IO_32BIT = (1 << 24), |
1090 | /* unmask IRQs */ | 1091 | /* unmask IRQs */ |
1091 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), | 1092 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), |
1092 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), | 1093 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), |
1093 | /* host is CY82C693 */ | 1094 | /* host is CY82C693 */ |
1094 | IDE_HFLAG_CY82C693 = (1 << 27), | 1095 | IDE_HFLAG_CY82C693 = (1 << 27), |
1095 | /* force host out of "simplex" mode */ | 1096 | /* force host out of "simplex" mode */ |
1096 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), | 1097 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), |
1097 | /* DSC overlap is unsupported */ | 1098 | /* DSC overlap is unsupported */ |
1098 | IDE_HFLAG_NO_DSC = (1 << 29), | 1099 | IDE_HFLAG_NO_DSC = (1 << 29), |
1099 | /* never use 32-bit I/O ops */ | 1100 | /* never use 32-bit I/O ops */ |
1100 | IDE_HFLAG_NO_IO_32BIT = (1 << 30), | 1101 | IDE_HFLAG_NO_IO_32BIT = (1 << 30), |
1101 | /* never unmask IRQs */ | 1102 | /* never unmask IRQs */ |
1102 | IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), | 1103 | IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), |
1103 | }; | 1104 | }; |
1104 | 1105 | ||
1105 | #ifdef CONFIG_BLK_DEV_OFFBOARD | 1106 | #ifdef CONFIG_BLK_DEV_OFFBOARD |
1106 | # define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE | 1107 | # define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE |
1107 | #else | 1108 | #else |
1108 | # define IDE_HFLAG_OFF_BOARD 0 | 1109 | # define IDE_HFLAG_OFF_BOARD 0 |
1109 | #endif | 1110 | #endif |
1110 | 1111 | ||
1111 | struct ide_port_info { | 1112 | struct ide_port_info { |
1112 | char *name; | 1113 | char *name; |
1113 | unsigned int (*init_chipset)(struct pci_dev *, const char *); | 1114 | unsigned int (*init_chipset)(struct pci_dev *, const char *); |
1114 | void (*init_iops)(ide_hwif_t *); | 1115 | void (*init_iops)(ide_hwif_t *); |
1115 | void (*init_hwif)(ide_hwif_t *); | 1116 | void (*init_hwif)(ide_hwif_t *); |
1116 | void (*init_dma)(ide_hwif_t *, unsigned long); | 1117 | void (*init_dma)(ide_hwif_t *, unsigned long); |
1117 | ide_pci_enablebit_t enablebits[2]; | 1118 | ide_pci_enablebit_t enablebits[2]; |
1118 | hwif_chipset_t chipset; | 1119 | hwif_chipset_t chipset; |
1119 | u8 extra; | 1120 | u8 extra; |
1120 | u32 host_flags; | 1121 | u32 host_flags; |
1121 | u8 pio_mask; | 1122 | u8 pio_mask; |
1122 | u8 swdma_mask; | 1123 | u8 swdma_mask; |
1123 | u8 mwdma_mask; | 1124 | u8 mwdma_mask; |
1124 | u8 udma_mask; | 1125 | u8 udma_mask; |
1125 | }; | 1126 | }; |
1126 | 1127 | ||
1127 | int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); | 1128 | int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); |
1128 | int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); | 1129 | int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); |
1129 | 1130 | ||
1130 | void ide_map_sg(ide_drive_t *, struct request *); | 1131 | void ide_map_sg(ide_drive_t *, struct request *); |
1131 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1132 | void ide_init_sg_cmd(ide_drive_t *, struct request *); |
1132 | 1133 | ||
1133 | #define BAD_DMA_DRIVE 0 | 1134 | #define BAD_DMA_DRIVE 0 |
1134 | #define GOOD_DMA_DRIVE 1 | 1135 | #define GOOD_DMA_DRIVE 1 |
1135 | 1136 | ||
1136 | struct drive_list_entry { | 1137 | struct drive_list_entry { |
1137 | const char *id_model; | 1138 | const char *id_model; |
1138 | const char *id_firmware; | 1139 | const char *id_firmware; |
1139 | }; | 1140 | }; |
1140 | 1141 | ||
1141 | int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); | 1142 | int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); |
1142 | 1143 | ||
1143 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1144 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1144 | int __ide_dma_bad_drive(ide_drive_t *); | 1145 | int __ide_dma_bad_drive(ide_drive_t *); |
1145 | int ide_id_dma_bug(ide_drive_t *); | 1146 | int ide_id_dma_bug(ide_drive_t *); |
1146 | 1147 | ||
1147 | u8 ide_find_dma_mode(ide_drive_t *, u8); | 1148 | u8 ide_find_dma_mode(ide_drive_t *, u8); |
1148 | 1149 | ||
1149 | static inline u8 ide_max_dma_mode(ide_drive_t *drive) | 1150 | static inline u8 ide_max_dma_mode(ide_drive_t *drive) |
1150 | { | 1151 | { |
1151 | return ide_find_dma_mode(drive, XFER_UDMA_6); | 1152 | return ide_find_dma_mode(drive, XFER_UDMA_6); |
1152 | } | 1153 | } |
1153 | 1154 | ||
1154 | void ide_dma_off_quietly(ide_drive_t *); | 1155 | void ide_dma_off_quietly(ide_drive_t *); |
1155 | void ide_dma_off(ide_drive_t *); | 1156 | void ide_dma_off(ide_drive_t *); |
1156 | void ide_dma_on(ide_drive_t *); | 1157 | void ide_dma_on(ide_drive_t *); |
1157 | int ide_set_dma(ide_drive_t *); | 1158 | int ide_set_dma(ide_drive_t *); |
1158 | void ide_check_dma_crc(ide_drive_t *); | 1159 | void ide_check_dma_crc(ide_drive_t *); |
1159 | ide_startstop_t ide_dma_intr(ide_drive_t *); | 1160 | ide_startstop_t ide_dma_intr(ide_drive_t *); |
1160 | 1161 | ||
1161 | int ide_build_sglist(ide_drive_t *, struct request *); | 1162 | int ide_build_sglist(ide_drive_t *, struct request *); |
1162 | void ide_destroy_dmatable(ide_drive_t *); | 1163 | void ide_destroy_dmatable(ide_drive_t *); |
1163 | 1164 | ||
1164 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 1165 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
1165 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1166 | extern int ide_build_dmatable(ide_drive_t *, struct request *); |
1166 | extern int ide_release_dma(ide_hwif_t *); | 1167 | extern int ide_release_dma(ide_hwif_t *); |
1167 | extern void ide_setup_dma(ide_hwif_t *, unsigned long); | 1168 | extern void ide_setup_dma(ide_hwif_t *, unsigned long); |
1168 | 1169 | ||
1169 | void ide_dma_host_set(ide_drive_t *, int); | 1170 | void ide_dma_host_set(ide_drive_t *, int); |
1170 | extern int ide_dma_setup(ide_drive_t *); | 1171 | extern int ide_dma_setup(ide_drive_t *); |
1171 | extern void ide_dma_start(ide_drive_t *); | 1172 | extern void ide_dma_start(ide_drive_t *); |
1172 | extern int __ide_dma_end(ide_drive_t *); | 1173 | extern int __ide_dma_end(ide_drive_t *); |
1173 | extern void ide_dma_lost_irq(ide_drive_t *); | 1174 | extern void ide_dma_lost_irq(ide_drive_t *); |
1174 | extern void ide_dma_timeout(ide_drive_t *); | 1175 | extern void ide_dma_timeout(ide_drive_t *); |
1175 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ | 1176 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ |
1176 | 1177 | ||
1177 | #else | 1178 | #else |
1178 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } | 1179 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } |
1179 | static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } | 1180 | static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } |
1180 | static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } | 1181 | static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } |
1181 | static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; } | 1182 | static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; } |
1182 | static inline void ide_dma_off(ide_drive_t *drive) { ; } | 1183 | static inline void ide_dma_off(ide_drive_t *drive) { ; } |
1183 | static inline void ide_dma_on(ide_drive_t *drive) { ; } | 1184 | static inline void ide_dma_on(ide_drive_t *drive) { ; } |
1184 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1185 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
1185 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1186 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
1186 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | 1187 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } |
1187 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 1188 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1188 | 1189 | ||
1189 | #ifndef CONFIG_BLK_DEV_IDEDMA_PCI | 1190 | #ifndef CONFIG_BLK_DEV_IDEDMA_PCI |
1190 | static inline void ide_release_dma(ide_hwif_t *drive) {;} | 1191 | static inline void ide_release_dma(ide_hwif_t *drive) {;} |
1191 | #endif | 1192 | #endif |
1192 | 1193 | ||
1193 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1194 | #ifdef CONFIG_BLK_DEV_IDEACPI |
1194 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); | 1195 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); |
1195 | extern void ide_acpi_get_timing(ide_hwif_t *hwif); | 1196 | extern void ide_acpi_get_timing(ide_hwif_t *hwif); |
1196 | extern void ide_acpi_push_timing(ide_hwif_t *hwif); | 1197 | extern void ide_acpi_push_timing(ide_hwif_t *hwif); |
1197 | extern void ide_acpi_init(ide_hwif_t *hwif); | 1198 | extern void ide_acpi_init(ide_hwif_t *hwif); |
1198 | void ide_acpi_port_init_devices(ide_hwif_t *); | 1199 | void ide_acpi_port_init_devices(ide_hwif_t *); |
1199 | extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); | 1200 | extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); |
1200 | #else | 1201 | #else |
1201 | static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } | 1202 | static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } |
1202 | static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } | 1203 | static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } |
1203 | static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } | 1204 | static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } |
1204 | static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } | 1205 | static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } |
1205 | static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } | 1206 | static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } |
1206 | static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | 1207 | static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} |
1207 | #endif | 1208 | #endif |
1208 | 1209 | ||
1209 | void ide_remove_port_from_hwgroup(ide_hwif_t *); | 1210 | void ide_remove_port_from_hwgroup(ide_hwif_t *); |
1210 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); | 1211 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); |
1211 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); | 1212 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); |
1212 | void ide_unregister(unsigned int, int, int); | 1213 | void ide_unregister(unsigned int, int, int); |
1213 | 1214 | ||
1214 | void ide_register_region(struct gendisk *); | 1215 | void ide_register_region(struct gendisk *); |
1215 | void ide_unregister_region(struct gendisk *); | 1216 | void ide_unregister_region(struct gendisk *); |
1216 | 1217 | ||
1217 | void ide_undecoded_slave(ide_drive_t *); | 1218 | void ide_undecoded_slave(ide_drive_t *); |
1218 | 1219 | ||
1219 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); | 1220 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); |
1220 | int ide_device_add(u8 idx[4], const struct ide_port_info *); | 1221 | int ide_device_add(u8 idx[4], const struct ide_port_info *); |
1221 | 1222 | ||
1222 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) | 1223 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) |
1223 | { | 1224 | { |
1224 | return hwif->hwif_data; | 1225 | return hwif->hwif_data; |
1225 | } | 1226 | } |
1226 | 1227 | ||
1227 | static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data) | 1228 | static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data) |
1228 | { | 1229 | { |
1229 | hwif->hwif_data = data; | 1230 | hwif->hwif_data = data; |
1230 | } | 1231 | } |
1231 | 1232 | ||
1232 | const char *ide_xfer_verbose(u8 mode); | 1233 | const char *ide_xfer_verbose(u8 mode); |
1233 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); | 1234 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
1234 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | 1235 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); |
1235 | 1236 | ||
1236 | static inline int ide_dev_has_iordy(struct hd_driveid *id) | 1237 | static inline int ide_dev_has_iordy(struct hd_driveid *id) |
1237 | { | 1238 | { |
1238 | return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; | 1239 | return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; |
1239 | } | 1240 | } |
1240 | 1241 | ||
1241 | static inline int ide_dev_is_sata(struct hd_driveid *id) | 1242 | static inline int ide_dev_is_sata(struct hd_driveid *id) |
1242 | { | 1243 | { |
1243 | /* | 1244 | /* |
1244 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | 1245 | * See if word 93 is 0 AND drive is at least ATA-5 compatible |
1245 | * verifying that word 80 by casting it to a signed type -- | 1246 | * verifying that word 80 by casting it to a signed type -- |
1246 | * this trick allows us to filter out the reserved values of | 1247 | * this trick allows us to filter out the reserved values of |
1247 | * 0x0000 and 0xffff along with the earlier ATA revisions... | 1248 | * 0x0000 and 0xffff along with the earlier ATA revisions... |
1248 | */ | 1249 | */ |
1249 | if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020) | 1250 | if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020) |
1250 | return 1; | 1251 | return 1; |
1251 | return 0; | 1252 | return 0; |
1252 | } | 1253 | } |
1253 | 1254 | ||
1254 | u64 ide_get_lba_addr(struct ide_taskfile *, int); | 1255 | u64 ide_get_lba_addr(struct ide_taskfile *, int); |
1255 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1256 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
1256 | 1257 | ||
1257 | typedef struct ide_pio_timings_s { | 1258 | typedef struct ide_pio_timings_s { |
1258 | int setup_time; /* Address setup (ns) minimum */ | 1259 | int setup_time; /* Address setup (ns) minimum */ |
1259 | int active_time; /* Active pulse (ns) minimum */ | 1260 | int active_time; /* Active pulse (ns) minimum */ |
1260 | int cycle_time; /* Cycle time (ns) minimum = */ | 1261 | int cycle_time; /* Cycle time (ns) minimum = */ |
1261 | /* active + recovery (+ setup for some chips) */ | 1262 | /* active + recovery (+ setup for some chips) */ |
1262 | } ide_pio_timings_t; | 1263 | } ide_pio_timings_t; |
1263 | 1264 | ||
1264 | unsigned int ide_pio_cycle_time(ide_drive_t *, u8); | 1265 | unsigned int ide_pio_cycle_time(ide_drive_t *, u8); |
1265 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); | 1266 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); |
1266 | extern const ide_pio_timings_t ide_pio_timings[6]; | 1267 | extern const ide_pio_timings_t ide_pio_timings[6]; |
1267 | 1268 | ||
1268 | int ide_set_pio_mode(ide_drive_t *, u8); | 1269 | int ide_set_pio_mode(ide_drive_t *, u8); |
1269 | int ide_set_dma_mode(ide_drive_t *, u8); | 1270 | int ide_set_dma_mode(ide_drive_t *, u8); |
1270 | 1271 | ||
1271 | void ide_set_pio(ide_drive_t *, u8); | 1272 | void ide_set_pio(ide_drive_t *, u8); |
1272 | 1273 | ||
1273 | static inline void ide_set_max_pio(ide_drive_t *drive) | 1274 | static inline void ide_set_max_pio(ide_drive_t *drive) |
1274 | { | 1275 | { |
1275 | ide_set_pio(drive, 255); | 1276 | ide_set_pio(drive, 255); |
1276 | } | 1277 | } |
1277 | 1278 | ||
1278 | extern spinlock_t ide_lock; | 1279 | extern spinlock_t ide_lock; |
1279 | extern struct mutex ide_cfg_mtx; | 1280 | extern struct mutex ide_cfg_mtx; |
1280 | /* | 1281 | /* |
1281 | * Structure locking: | 1282 | * Structure locking: |
1282 | * | 1283 | * |
1283 | * ide_cfg_mtx and ide_lock together protect changes to | 1284 | * ide_cfg_mtx and ide_lock together protect changes to |
1284 | * ide_hwif_t->{next,hwgroup} | 1285 | * ide_hwif_t->{next,hwgroup} |
1285 | * ide_drive_t->next | 1286 | * ide_drive_t->next |
1286 | * | 1287 | * |
1287 | * ide_hwgroup_t->busy: ide_lock | 1288 | * ide_hwgroup_t->busy: ide_lock |
1288 | * ide_hwgroup_t->hwif: ide_lock | 1289 | * ide_hwgroup_t->hwif: ide_lock |
1289 | * ide_hwif_t->mate: constant, no locking | 1290 | * ide_hwif_t->mate: constant, no locking |
1290 | * ide_drive_t->hwif: constant, no locking | 1291 | * ide_drive_t->hwif: constant, no locking |
1291 | */ | 1292 | */ |
1292 | 1293 | ||
1293 | #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) | 1294 | #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) |
1294 | 1295 | ||
1295 | extern struct bus_type ide_bus_type; | 1296 | extern struct bus_type ide_bus_type; |
1296 | 1297 | ||
1297 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ | 1298 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ |
1298 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) | 1299 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) |
1299 | 1300 | ||
1300 | /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ | 1301 | /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ |
1301 | #define ide_id_has_flush_cache_ext(id) \ | 1302 | #define ide_id_has_flush_cache_ext(id) \ |
1302 | (((id)->cfs_enable_2 & 0x2400) == 0x2400) | 1303 | (((id)->cfs_enable_2 & 0x2400) == 0x2400) |
1303 | 1304 | ||
1304 | static inline void ide_dump_identify(u8 *id) | 1305 | static inline void ide_dump_identify(u8 *id) |
1305 | { | 1306 | { |
1306 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); | 1307 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); |
1307 | } | 1308 | } |
1308 | 1309 | ||
1309 | static inline int hwif_to_node(ide_hwif_t *hwif) | 1310 | static inline int hwif_to_node(ide_hwif_t *hwif) |
1310 | { | 1311 | { |
1311 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 1312 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1312 | return dev ? pcibus_to_node(dev->bus) : -1; | 1313 | return dev ? pcibus_to_node(dev->bus) : -1; |
1313 | } | 1314 | } |
1314 | 1315 | ||
1315 | static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) | 1316 | static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) |
1316 | { | 1317 | { |
1317 | ide_hwif_t *hwif = HWIF(drive); | 1318 | ide_hwif_t *hwif = HWIF(drive); |
1318 | 1319 | ||
1319 | return &hwif->drives[(drive->dn ^ 1) & 1]; | 1320 | return &hwif->drives[(drive->dn ^ 1) & 1]; |
1320 | } | 1321 | } |
1321 | 1322 | ||
1322 | static inline void ide_set_irq(ide_drive_t *drive, int on) | 1323 | static inline void ide_set_irq(ide_drive_t *drive, int on) |
1323 | { | 1324 | { |
1324 | drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); | 1325 | drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); |
1325 | } | 1326 | } |
1326 | 1327 | ||
1327 | #endif /* _IDE_H */ | 1328 | #endif /* _IDE_H */ |
1328 | 1329 |