Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Apr 1998 14:32:01 -0800
From:      Parag Patel <parag@cgt.com>
To:        "freebsd-current" <freebsd-current@FreeBSD.ORG>
Cc:        "Thomas J. Merritt" <tjm@codegen.com>
Subject:   Questions for PCI-IDE driver owner
Message-ID:  <199804052230.PAA18915@mail1.sirius.com>

next in thread | raw e-mail | index | archive | help
--Emailer_-1319507113
Content-Type: text/plain; charset="US-ASCII"

I'm not sure who's currently working or "owning" the current PCI-IDE 
drivers, but I have a number of questions and problems about the current 
code that I'd like to discuss.  I hope this is the right list.

I am trying to get a CMD PCI646U2 chip to work under FreeBSD-CURRENT 
(3.0).  This is a new PCI Ultra-DMA IDE chip with two controllers (up to 
4 drives).  I've been modifying the pci_ide.c file to add support for 
this part.  Programmed I/O was easy to bring up, but I'm having some 
difficulties getting DMA to work correctly.

I have a single 3Gb Quantum UIDE drive as a master on my CMD evaluation 
card.  There are no other drives plugged into this card.  I boot the 486 
entirely over NFS and then exercise the driver so I can utterly trash the 
disk and not care, plus I don't have to fsck after reboot. :-)


In sys/pci/ide_pci.c:

1) ide_pci_dmainit() needs to always call the vendor_dmainit() routine 
for the CMD part.  Reset sometimes leaves the part in a funny state and 
it doesn't appear to work correctly without making sure the right bits 
are turned on.  The problem may be related to the following problems.  
For now, I've commented out the "if" to check to see if DMA has already 
been enabled.

Is it OK to always call dmainit() for other parts, or should I add the 
necessary code during the device probing?  (The probe code has to be 
modified much like the Promise controller.)


2) ide_pci_camdma() seems to return the wrong cookie to the i386/isa/wd.c 
driver.  My drive should be cp->ctlr=0 and cp->unit=0, but because of the 
order the cookies are created, ied_pci_candma() always returns 
cp->unit=1, which is the first matching cookie it finds.  The loop 
compares cp->ctlr with the parameter "unit" but it's not clear to me if 
this is supposed to be the controller number, the unit number, or if an 
additional drive number should also be passed in.

This affects the CMD part since I can turn on DMA for each of the 
master/slave drives independently, and I had initially coded the 
cmd646_dmainit() to use cp->unit to determine which one to turn on.  It 
would, of course, turn on a nonexistent drive when given the wrong 
cookie.  For now, I've simply turned both on as I only have one drive on 
the controller.  Clearly, this is not the right thing to do. :-)

I'm wondering why getting the wrong cookie would work for the other PCI 
IDE controllers, or if I've just missed something important during 
probing.


3) The i386/isa/wd.c driver calls ide_pci_status() in pci_ide.c.  
ide_pci_status() looks at the BMISTA_INTERRUPT bit to see if there has 
been a DMA interrupt or not.  However, at bootup, ide_pci_status() is 
called from wd.c without a preceding call to ide_pci_dmastart(), so there 
is no DMA activity and BMISTA_INTERRUPT is never set on the CMD part.

My hack to workaround this is to check another CMD register for any 
interrupt (not just DMA) and return WDDS_INTERRUPT if either interrupt 
flag is set.  This test is only done once - the first time 
ide_pci_status() is called.  Thereafter, it only checks the 
BMISTA_INTERRUPT bit.  This lets it get past the bootup initialization 
sequence and it appears to run fine afterward.

Without this hack, the driver essentially hangs waiting for a DMA 
interrupt that never arrives, and eventually it's time for the 
three-fingered salute.

The question is, why is the wd.c driver calling ide_pci_status() *and* 
waiting for an interrupt when it has not started a DMA transaction?  Do 
other IDE controllers always set the DMA interrupt bit even when the 
interrupt has nothing to do with DMA?  Is some other IDE transaction 
expected to turn on the DMA interrupt bit?


For your amusement, I've enclosed the dmesg output from a session where I 
simply logged in and ran "fdisk" a few times.  I've inserted debug 
printfs in all the ide_pci.c routines to see what order things are 
called.  I print out the ctrl:unit numbers in most of the output so it's 
clear the wrong cookie is being used.

Any help would be much appreciated.  Thanks in advance.


    -- Parag Patel <parag@cgt.com>

--Emailer_-1319507113
Content-Type: application/octet-stream; name="dmesg.SIT";
 x-mac-type="53495444";
 x-mac-creator="53495421"
Content-transfer-encoding: base64
Content-Disposition: Attachment; filename="dmesg.SIT"

U0lUIQABAAAQR3JMYXUC3QAAABbd3QANBWRtZXNnAACgI/4CAAADNNvQA1X3EAATOAIDOiykA1Uv
ngmGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////1RFWFRSKmNoAQCxTUMvsU1DvgAAAAAAALVI
AAAAAAAAD8EAAEz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+3aWF/3nz3IvL36UlJzDxYdwOW26F2IGf+EGLwgBDkq3A
bpNqfvR/
--Emailer_-1319507113--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804052230.PAA18915>