Are your IDE drives slower than they used to be?


This weekend during an unexpected burst of energy, I tackled the problem of my IDE drive which seemed to have gotten slower recently. A little detective work lead me to the difference between PIO and DMA mode. (Which I previously hadn’t paid any attention to. Why not? Windows takes care of all this hardware stuff, right?)

If you have sufficiently current hardware, DMA mode should be much faster than PIO mode. As I understand it (and I’m not a hardware geek) PIO mode sends the data through the motherboard first, and makes the CPU do more work.

To see if this might be the problem, in the Device Manager, expand “IDE ATA/ATAPI controllers”.  Right click on “Primary IDE Channel”, then go to the “Advanced Settings” tab. In my case, the “Current Transfer Mode” was “PIO”, not the expected “Ultra DMA Mode 5”.

Why does this happen? Check out the knowledge base article: http://support.microsoft.com/?kbid=817472 In a nutshell, Windows sets the mode back to PIO mode if it sees enough CRC errors.

One web page suggested uninstalling the Primary IDE Channel, then rebooting. When the system reboots, Windows automatically detects the IDE Channel and installs it anew. Trying this, I was pleasantly to see that it worked. My Primary IDE Channel was happily back in Ultra DMA Mode 5, and my system was much zippier.

Another good read on this subject: http://www.michna.com/kb/WxDMA.htm


Comments (4)

  1. Mike Dimmick says:

    This often means that you’ve got the wrong cable connected between your drive and the controller. You should have an 80-way cable connected to any ATA-100 drive. The connectors for 40- and 80-way cables are identical, but the wires in the ribbon are much smaller for the 80- than the 40-way.

    In the 80-way cable, every other wire is a ground wire. This helps to reduce crosstalk between signal cables – basically noise caused by signals on adjacent wires which prevents the system from interpreting the data correctly. 80-way cables cost £4.99 including tax over here, so it’s hardly a hardship to completely equip the system. Some motherboard and system suppliers are too cheap to do this – I’ve seen systems with one 80- and one 40-way cable, and systems where the cable only has two connectors rather than three, just to save a few pennies.

    The difference between PIO and DMA modes: PIO stands for Programmed I/O. In this mode, when the OS wants to write to the drive, the driver reads memory locations to registers, then writes those register values to either other memory locations, or to I/O ports depending on the controller. To read, the driver sends a command to the drive; when data is ready the drive raises an interrupt line. In the interrupt handler, the driver reads from the controller’s memory locations or I/O ports and writes to the destination buffer.

    In DMA [Direct Memory Access] mode, to write, the driver simply tells the drive to write the data from a block of physical memory locations. The drive then steals (or masters) the memory bus away from the processor as it reads the data from memory; the drive is typically so much slower than the processor that the processor loses about 1 out of 10 potential memory access cycles. If all the data it’s working on is cached, it may not even need to access the memory. Similarly, to read, the driver tells the drive which blocks to read and where in physical memory to write them to. The drive steals bus cycles to transfer data to main memory, then raises an interrupt to signal to the driver that it’s done. The ISR completes the I/O request.

    The net result is that in PIO mode, you lose a load of CPU cycles that could be used for useful work (or for saving power!), and gain a huge amount of latency as the CPU copies data a few bytes at a time all the way across the of system buses, wrecking cache locality along the way, not to mention the latency of raising an interrupt in the first place.

    If you plan to rip CDs, make sure your CD drive is in DMA mode. Windows Media Player skips badly if you try to play back while ripping if the CD performance is poor. Heck, do it anyway – all CD operations are improved by use of DMA mode. Windows defaults to PIO mode for CD-ROM (and similar) drives, even if they’re DMA-capable. My AOpen DVD+RW burner is capable of UDMA Mode 2.

  2. This is a hangover from the old 6Mhz AT bus design where DMA cycles were slower than the equivalent REP INSW x86 instruction. The fastest way to get data moving on the AT bus was memory mapping a card as a 16 bit card and using REP MOVSW (IIRC this took 5 rather than 6 bus cycles for the IO equivalent) and worked quite nicely. One problem was the SBHE signal (which decided if an access was 8 or 16 bit) was only supposed to work on 128K byte boundaries (it was designed for DRAM cards), you could get decodes to work on less than that (typically 16K or 32K) but to do so meant you violated the worst case timing if you looked at the circuit diagrams in the AT tech reference.

    The 80/40 cable bit reminds me that during a beta (of either XP or Win2K I can’t remember for sure) you could install quite happily on a 40 way cable but come the first reboot the whole thing went badly wrong if you had UltraDMA drive as windows tried to go into UltraDMA mode on the first reboot, ugly and not obvious as the hardware worked fine with Win98.

  3. Fei Liu says:

    Here is a tip about video card acceleration. Yesterday I noticed my ati 9600 card (Matt, check this too since you have 9500 card) smartgart reports agp acceleration as ‘off’ in displayer properties->settings->advanced. My motherboard is ecs k7s5a and it uses SIS chip instead of via chip. I normally install via4in1 because I mostly use via chip in the past. Finally I had this figured out and went to sis.com.tw and downloaded latest sis agp driver 117e. It worked right away and windows report 4x agp now because my mobo doesn’t support 8x.