xref: /OK3568_Linux_fs/kernel/Documentation/ide/ide.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun============================================
2*4882a593SmuzhiyunInformation regarding the Enhanced IDE drive
3*4882a593Smuzhiyun============================================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun   The hdparm utility can be used to control various IDE features on a
6*4882a593Smuzhiyun   running system. It is packaged separately.  Please Look for it on popular
7*4882a593Smuzhiyun   linux FTP sites.
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun-------------------------------------------------------------------------------
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun.. important::
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun   BUGGY IDE CHIPSETS CAN CORRUPT DATA!!
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun    PCI versions of the CMD640 and RZ1000 interfaces are now detected
16*4882a593Smuzhiyun    automatically at startup when PCI BIOS support is configured.
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun    Linux disables the "prefetch" ("readahead") mode of the RZ1000
19*4882a593Smuzhiyun    to prevent data corruption possible due to hardware design flaws.
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun    For the CMD640, linux disables "IRQ unmasking" (hdparm -u1) on any
22*4882a593Smuzhiyun    drive for which the "prefetch" mode of the CMD640 is turned on.
23*4882a593Smuzhiyun    If "prefetch" is disabled (hdparm -p8), then "IRQ unmasking" can be
24*4882a593Smuzhiyun    used again.
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun    For the CMD640, linux disables "32bit I/O" (hdparm -c1) on any drive
27*4882a593Smuzhiyun    for which the "prefetch" mode of the CMD640 is turned off.
28*4882a593Smuzhiyun    If "prefetch" is enabled (hdparm -p9), then "32bit I/O" can be
29*4882a593Smuzhiyun    used again.
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun    The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT*
32*4882a593Smuzhiyun    automatically detected by Linux.  For safe, reliable operation with such
33*4882a593Smuzhiyun    interfaces, one *MUST* use the "cmd640.probe_vlb" kernel option.
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun    Use of the "serialize" option is no longer necessary.
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun-------------------------------------------------------------------------------
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunCommon pitfalls
40*4882a593Smuzhiyun===============
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun- 40-conductor IDE cables are capable of transferring data in DMA modes up to
43*4882a593Smuzhiyun  udma2, but no faster.
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun- If possible devices should be attached to separate channels if they are
46*4882a593Smuzhiyun  available. Typically the disk on the first and CD-ROM on the second.
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun- If you mix devices on the same cable, please consider using similar devices
49*4882a593Smuzhiyun  in respect of the data transfer mode they support.
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun- Even better try to stick to the same vendor and device type on the same
52*4882a593Smuzhiyun  cable.
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunThis is the multiple IDE interface driver, as evolved from hd.c
55*4882a593Smuzhiyun===============================================================
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunIt supports up to 9 IDE interfaces per default, on one or more IRQs (usually
58*4882a593Smuzhiyun14 & 15).  There can be up to two drives per interface, as per the ATA-6 spec.::
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun  Primary:    ide0, port 0x1f0; major=3;  hda is minor=0; hdb is minor=64
61*4882a593Smuzhiyun  Secondary:  ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64
62*4882a593Smuzhiyun  Tertiary:   ide2, port 0x1e8; major=33; hde is minor=0; hdf is minor=64
63*4882a593Smuzhiyun  Quaternary: ide3, port 0x168; major=34; hdg is minor=0; hdh is minor=64
64*4882a593Smuzhiyun  fifth..     ide4, usually PCI, probed
65*4882a593Smuzhiyun  sixth..     ide5, usually PCI, probed
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunTo access devices on interfaces > ide0, device entries please make sure that
68*4882a593Smuzhiyundevice files for them are present in /dev.  If not, please create such
69*4882a593Smuzhiyunentries, by using /dev/MAKEDEV.
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunThis driver automatically probes for most IDE interfaces (including all PCI
72*4882a593Smuzhiyunones), for the drives/geometries attached to those interfaces, and for the IRQ
73*4882a593Smuzhiyunlines being used by the interfaces (normally 14, 15 for ide0/ide1).
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunAny number of interfaces may share a single IRQ if necessary, at a slight
76*4882a593Smuzhiyunperformance penalty, whether on separate cards or a single VLB card.
77*4882a593SmuzhiyunThe IDE driver automatically detects and handles this.  However, this may
78*4882a593Smuzhiyunor may not be harmful to your hardware.. two or more cards driving the same IRQ
79*4882a593Smuzhiyuncan potentially burn each other's bus driver, though in practice this
80*4882a593Smuzhiyunseldom occurs.  Be careful, and if in doubt, don't do it!
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunDrives are normally found by auto-probing and/or examining the CMOS/BIOS data.
83*4882a593SmuzhiyunFor really weird situations, the apparent (fdisk) geometry can also be specified
84*4882a593Smuzhiyunon the kernel "command line" using LILO.  The format of such lines is::
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun	ide_core.chs=[interface_number.device_number]:cyls,heads,sects
87*4882a593Smuzhiyun
88*4882a593Smuzhiyunor::
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun	ide_core.cdrom=[interface_number.device_number]
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunFor example::
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun	ide_core.chs=1.0:1050,32,64  ide_core.cdrom=1.1
95*4882a593Smuzhiyun
96*4882a593SmuzhiyunThe results of successful auto-probing may override the physical geometry/irq
97*4882a593Smuzhiyunspecified, though the "original" geometry may be retained as the "logical"
98*4882a593Smuzhiyungeometry for partitioning purposes (fdisk).
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunIf the auto-probing during boot time confuses a drive (ie. the drive works
101*4882a593Smuzhiyunwith hd.c but not with ide.c), then an command line option may be specified
102*4882a593Smuzhiyunfor each drive for which you'd like the drive to skip the hardware
103*4882a593Smuzhiyunprobe/identification sequence.  For example::
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun	ide_core.noprobe=0.1
106*4882a593Smuzhiyun
107*4882a593Smuzhiyunor::
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun	ide_core.chs=1.0:768,16,32
110*4882a593Smuzhiyun	ide_core.noprobe=1.0
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunNote that when only one IDE device is attached to an interface, it should be
113*4882a593Smuzhiyunjumpered as "single" or "master", *not* "slave".  Many folks have had
114*4882a593Smuzhiyun"trouble" with cdroms because of this requirement, so the driver now probes
115*4882a593Smuzhiyunfor both units, though success is more likely when the drive is jumpered
116*4882a593Smuzhiyuncorrectly.
117*4882a593Smuzhiyun
118*4882a593SmuzhiyunCourtesy of Scott Snyder and others, the driver supports ATAPI cdrom drives
119*4882a593Smuzhiyunsuch as the NEC-260 and the new MITSUMI triple/quad speed drives.
120*4882a593SmuzhiyunSuch drives will be identified at boot time, just like a hard disk.
121*4882a593Smuzhiyun
122*4882a593SmuzhiyunIf for some reason your cdrom drive is *not* found at boot time, you can force
123*4882a593Smuzhiyunthe probe to look harder by supplying a kernel command line parameter
124*4882a593Smuzhiyunvia LILO, such as:::
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun	ide_core.cdrom=1.0	/* "master" on second interface (hdc) */
127*4882a593Smuzhiyun
128*4882a593Smuzhiyunor::
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun	ide_core.cdrom=1.1	/* "slave" on second interface (hdd) */
131*4882a593Smuzhiyun
132*4882a593SmuzhiyunFor example, a GW2000 system might have a hard drive on the primary
133*4882a593Smuzhiyuninterface (/dev/hda) and an IDE cdrom drive on the secondary interface
134*4882a593Smuzhiyun(/dev/hdc).  To mount a CD in the cdrom drive, one would use something like::
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun	ln -sf /dev/hdc /dev/cdrom
137*4882a593Smuzhiyun	mkdir /mnt/cdrom
138*4882a593Smuzhiyun	mount /dev/cdrom /mnt/cdrom -t iso9660 -o ro
139*4882a593Smuzhiyun
140*4882a593SmuzhiyunIf, after doing all of the above, mount doesn't work and you see
141*4882a593Smuzhiyunerrors from the driver (with dmesg) complaining about `status=0xff`,
142*4882a593Smuzhiyunthis means that the hardware is not responding to the driver's attempts
143*4882a593Smuzhiyunto read it.  One of the following is probably the problem:
144*4882a593Smuzhiyun
145*4882a593Smuzhiyun  - Your hardware is broken.
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun  - You are using the wrong address for the device, or you have the
148*4882a593Smuzhiyun    drive jumpered wrong.  Review the configuration instructions above.
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun  - Your IDE controller requires some nonstandard initialization sequence
151*4882a593Smuzhiyun    before it will work properly.  If this is the case, there will often
152*4882a593Smuzhiyun    be a separate MS-DOS driver just for the controller.  IDE interfaces
153*4882a593Smuzhiyun    on sound cards usually fall into this category.  Such configurations
154*4882a593Smuzhiyun    can often be made to work by first booting MS-DOS, loading the
155*4882a593Smuzhiyun    appropriate drivers, and then warm-booting linux (without powering
156*4882a593Smuzhiyun    off).  This can be automated using loadlin in the MS-DOS autoexec.
157*4882a593Smuzhiyun
158*4882a593SmuzhiyunIf you always get timeout errors, interrupts from the drive are probably
159*4882a593Smuzhiyunnot making it to the host.  Check how you have the hardware jumpered
160*4882a593Smuzhiyunand make sure it matches what the driver expects (see the configuration
161*4882a593Smuzhiyuninstructions above).  If you have a PCI system, also check the BIOS
162*4882a593Smuzhiyunsetup; I've had one report of a system which was shipped with IRQ 15
163*4882a593Smuzhiyundisabled by the BIOS.
164*4882a593Smuzhiyun
165*4882a593SmuzhiyunThe kernel is able to execute binaries directly off of the cdrom,
166*4882a593Smuzhiyunprovided it is mounted with the default block size of 1024 (as above).
167*4882a593Smuzhiyun
168*4882a593SmuzhiyunPlease pass on any feedback on any of this stuff to the maintainer,
169*4882a593Smuzhiyunwhose address can be found in linux/MAINTAINERS.
170*4882a593Smuzhiyun
171*4882a593SmuzhiyunThe IDE driver is modularized.  The high level disk/CD-ROM/tape/floppy
172*4882a593Smuzhiyundrivers can always be compiled as loadable modules, the chipset drivers
173*4882a593Smuzhiyuncan only be compiled into the kernel, and the core code (ide.c) can be
174*4882a593Smuzhiyuncompiled as a loadable module provided no chipset support is needed.
175*4882a593Smuzhiyun
176*4882a593SmuzhiyunWhen using ide.c as a module in combination with kmod, add::
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun	alias block-major-3 ide-probe
179*4882a593Smuzhiyun
180*4882a593Smuzhiyunto a configuration file in /etc/modprobe.d/.
181*4882a593Smuzhiyun
182*4882a593SmuzhiyunWhen ide.c is used as a module, you can pass command line parameters to the
183*4882a593Smuzhiyundriver using the "options=" keyword to insmod, while replacing any ',' with
184*4882a593Smuzhiyun';'.
185*4882a593Smuzhiyun
186*4882a593Smuzhiyun
187*4882a593SmuzhiyunSummary of ide driver parameters for kernel command line
188*4882a593Smuzhiyun========================================================
189*4882a593Smuzhiyun
190*4882a593SmuzhiyunFor legacy IDE VLB host drivers (ali14xx/dtc2278/ht6560b/qd65xx/umc8672)
191*4882a593Smuzhiyunyou need to explicitly enable probing by using "probe" kernel parameter,
192*4882a593Smuzhiyuni.e. to enable probing for ALI M14xx chipsets (ali14xx host driver) use:
193*4882a593Smuzhiyun
194*4882a593Smuzhiyun* "ali14xx.probe" boot option when ali14xx driver is built-in the kernel
195*4882a593Smuzhiyun
196*4882a593Smuzhiyun* "probe" module parameter when ali14xx driver is compiled as module
197*4882a593Smuzhiyun  ("modprobe ali14xx probe")
198*4882a593Smuzhiyun
199*4882a593SmuzhiyunAlso for legacy CMD640 host driver (cmd640) you need to use "probe_vlb"
200*4882a593Smuzhiyunkernel paremeter to enable probing for VLB version of the chipset (PCI ones
201*4882a593Smuzhiyunare detected automatically).
202*4882a593Smuzhiyun
203*4882a593SmuzhiyunYou also need to use "probe" kernel parameter for ide-4drives driver
204*4882a593Smuzhiyun(support for IDE generic chipset with four drives on one port).
205*4882a593Smuzhiyun
206*4882a593SmuzhiyunTo enable support for IDE doublers on Amiga use "doubler" kernel parameter
207*4882a593Smuzhiyunfor gayle host driver (i.e. "gayle.doubler" if the driver is built-in).
208*4882a593Smuzhiyun
209*4882a593SmuzhiyunTo force ignoring cable detection (this should be needed only if you're using
210*4882a593Smuzhiyunshort 40-wires cable which cannot be automatically detected - if this is not
211*4882a593Smuzhiyuna case please report it as a bug instead) use "ignore_cable" kernel parameter:
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun* "ide_core.ignore_cable=[interface_number]" boot option if IDE is built-in
214*4882a593Smuzhiyun  (i.e. "ide_core.ignore_cable=1" to force ignoring cable for "ide1")
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun* "ignore_cable=[interface_number]" module parameter (for ide_core module)
217*4882a593Smuzhiyun  if IDE is compiled as module
218*4882a593Smuzhiyun
219*4882a593SmuzhiyunOther kernel parameters for ide_core are:
220*4882a593Smuzhiyun
221*4882a593Smuzhiyun* "nodma=[interface_number.device_number]" to disallow DMA for a device
222*4882a593Smuzhiyun
223*4882a593Smuzhiyun* "noflush=[interface_number.device_number]" to disable flush requests
224*4882a593Smuzhiyun
225*4882a593Smuzhiyun* "nohpa=[interface_number.device_number]" to disable Host Protected Area
226*4882a593Smuzhiyun
227*4882a593Smuzhiyun* "noprobe=[interface_number.device_number]" to skip probing
228*4882a593Smuzhiyun
229*4882a593Smuzhiyun* "nowerr=[interface_number.device_number]" to ignore the WRERR_STAT bit
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun* "cdrom=[interface_number.device_number]" to force device as a CD-ROM
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun* "chs=[interface_number.device_number]" to force device as a disk (using CHS)
234*4882a593Smuzhiyun
235*4882a593Smuzhiyun
236*4882a593SmuzhiyunSome Terminology
237*4882a593Smuzhiyun================
238*4882a593Smuzhiyun
239*4882a593SmuzhiyunIDE
240*4882a593Smuzhiyun  Integrated Drive Electronics, meaning that each drive has a built-in
241*4882a593Smuzhiyun  controller, which is why an "IDE interface card" is not a "controller card".
242*4882a593Smuzhiyun
243*4882a593SmuzhiyunATA
244*4882a593Smuzhiyun  AT (the old IBM 286 computer) Attachment Interface, a draft American
245*4882a593Smuzhiyun  National Standard for connecting hard drives to PCs.  This is the official
246*4882a593Smuzhiyun  name for "IDE".
247*4882a593Smuzhiyun
248*4882a593Smuzhiyun  The latest standards define some enhancements, known as the ATA-6 spec,
249*4882a593Smuzhiyun  which grew out of vendor-specific "Enhanced IDE" (EIDE) implementations.
250*4882a593Smuzhiyun
251*4882a593SmuzhiyunATAPI
252*4882a593Smuzhiyun  ATA Packet Interface, a new protocol for controlling the drives,
253*4882a593Smuzhiyun  similar to SCSI protocols, created at the same time as the ATA2 standard.
254*4882a593Smuzhiyun  ATAPI is currently used for controlling CDROM, TAPE and FLOPPY (ZIP or
255*4882a593Smuzhiyun  LS120/240) devices, removable R/W cartridges, and for high capacity hard disk
256*4882a593Smuzhiyun  drives.
257*4882a593Smuzhiyun
258*4882a593Smuzhiyunmlord@pobox.com
259*4882a593Smuzhiyun
260*4882a593Smuzhiyun
261*4882a593SmuzhiyunWed Apr 17 22:52:44 CEST 2002 edited by Marcin Dalecki, the current
262*4882a593Smuzhiyunmaintainer.
263*4882a593Smuzhiyun
264*4882a593SmuzhiyunWed Aug 20 22:31:29 CEST 2003 updated ide boot options to current ide.c
265*4882a593Smuzhiyuncomments at 2.6.0-test4 time. Maciej Soltysiak <solt@dns.toxicfilms.tv>
266