The HyperNews Linux KHG Discussion Pages

## Bus-Mastered DMA support for Triton

  Forum: Device Drivers
  Keywords: dma busmaster hdparm
  Date: Tue, 30 Sep 1997 14:19:30 GMT
  From: <sgray@preferred.com>

Hi, I'm trying to understand bus-mastered dma (ide) for a long time. However, I clearly don't understand what is going on. I first compiled support into my kernel by selecting: [*] Intel PIIX/PIIX3/PIIX4 (Triton 430FX/HX/VX/TX, 440FX) DMA support I then added the following code to my rc.local initialization script:
           # Added by Scott Gray on 9/5/97
            # hdparm used to set transfer mode to
            # multiword DMA mode2
            #
            # -d1:  enable the "using_dma" flag
            # -X34: ensure the drive is programmed for DMA mode 2
            if [ -f /sbin/hdparm ]; then
               echo "Setting hda transfer mode to DMA mode2"
               /sbin/hdparm -d1 -X34 /dev/hda
               echo "Setting hdb transfer mode to DMA mode2"
               /sbin/hdparm -d1 -X34 /dev/hdb
            fi
            # A message indicating success/failure is generated
            # and sent to STDOUT at boot-up.
When I enter the command: "hdparm -i" the follow output is generated:
    /dev/hda:
     multcount    =  16 (on)
     I/O support  =  1 (32-bit)
     unmaskirq    =  0 (off)
     using_dma    =  1 (on)
     keepsettings =  0 (off)
     nowerr       =  0 (off)
     readonly     =  0 (off)
     readahead    =  8 (on)
     geometry     = 622/255/63, sectors = 10003456, start = 0
However, when cat /proc/dma I get:
     1: SoundBlaster8
     4: cascade
     5: SoundBlaster16
I believe the DMA BusMastering is probably working but I would like to understand a little more about what is going on. Shouldn't a channel be allocated for the ide drive? Or does this form of DMA bypass the 3rd party DMA controller found on the main board. If yes then does this mean that the DMA controller is actually on the drive itself? When I cat /proc/ioports I get: 0000-001f : dma1 0020-003f : pic1 0040-005f : timer 0060-006f : keyboard 0070-007f : rtc 0080-008f : dma page reg 00a0-00bf : pic2 00c0-00df : dma2 00f0-00ff : fpu 0170-0177 : ide1 01f0-01f7 : ide0 0220-022f : soundblaster 02f8-02ff : serial(auto) 0300-031f : NE2000 0330-0333 : SB MIDI 0376-0376 : ide1 0388-038b : OPL3/OPL2 03c0-03df : vga+ 03f0-03f5 : floppy 03f6-03f6 : ide0 03f7-03f7 : floppy DIR 03f8-03ff : serial(auto) ffa0-ffa7 : IDE DMA <--- What is this? ffa8-ffaf : IDE DMA <---What is this? As you can see, I'm pretty confused but I think if someone who know could explain this to me I'm not that far away from understanding. Thanks, Scott Gray :) PS: I'm interested in learning more about device drivers in particular "block device drivers." Could anyone recommend a book or some web additional web resources. I was hoping to find something that talked about the big picture "in otherwords the basic things that need to be done" before diving into the kernel source code. Something like a cook book. First you do this, then this, etc. My drive info is as follows: /dev/hda:
     Model=Maxtor 85120A8, FwRev=AA8Z2225, SerialNo=C804RA6A
     Config={ Fixed }
     RawCHS=9924/16/63, TrkSize=0, SectSize=0, ECCbytes=20
     BuffType=3(DualPortCache), BuffSize=256kB, MaxMultSect=16, MultSect=16
     DblWordIO=no, maxPIO=2(fast), DMA=yes, maxDMA=2(fast)
     CurCHS=9924/16/63, CurSects=10003392, LBA=yes, LBAsects=10003456
     tDMA={min:120,rec:120}, DMA modes: mword0 mword1 mword2
     IORDY=on/off, tPIO={min:120,w/IORDY:120}, PIO modes: mode3 mode4

Messages

1. DMA allocated only when in use by Michael K. Johnson