From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,8a36ca98b2a920d8,start X-Google-Attributes: gidfee84,public From: Monty Brandenberg Subject: Re: Is it able to open CIA DMA window#2 in device driver? Date: 1998/05/21 Message-ID: <3563B8A1.44A33497@ne.mediaone.net>#1/1 X-Deja-AN: 355142806 Content-Transfer-Encoding: 7bit References: <6jti6j$qs6$1@nnrp1.dejanews.com> Mime-Version: 1.0 Reply-To: mcbinc@ne.mediaone.net.MAPS.SPAM To: apachexm@usa.net Content-Type: text/plain; charset=us-ascii Organization: MCB, Inc. Newsgroups: comp.unix.osf.osf1 apachexm@usa.net wrote: > > I am programming a device driver in Digital UNIX 4.0d on PC164LX motherboard. > Because the dma address register of our PCI card has only 26 bits. I cannot > let it perform DMA using the CIA DMA windows#1 opened by OS(It is in the > address range between 1G-2G). CIA DMA window#2 is disabled by OS. > Can we open it in driver? If we can, how to do it? > I use the PHYS_TO_KSEG() to get the kseg addr of CIA window#2 registers, > assign them the value directly and open it. > DMA of our PCI card can work now, but the OS is not stable too! > Is the procdure I post above correct? As a rule, the above style is never correct on anything other than a Wintel machine... First, you didn't mention the dma_map_xxx() functions which exist to abstract the various cpu, system, and pci implementations away from the programmer. These would be the normal answer to your problem if not for your non- conforming card. The longterm fix is to have the dma_map_alloc() interface extended to take an address limit or similar option and the OS people should be pestered to this end. (I have a vague recollection that there may be a way to do this by opening an opaque data structure and the use of some undocumented DMA_* flags...) But since you are stuck for the moment, you may consider cpu-, system-, and bus-specific workarounds, like you're suggesting, as a last resort. Working from memory, the CIA has four windows (though there may only be two on old implementations). OSF uses at least two: one to directly map physical memory onto the PCI addresses (the 0x40000000-0x7fffffff map you see) and another for scatter/gather mapping of dynamic requests to make physically discontiguous pages in the system appear contiguous to the PCI. Also note that at a certain memory size threshold, typically 1GB, there is a different convention and you are again in uncharted waters. *Which* two windows OSF is guaranteed to be using I can't say off hand. But even if you avoided those two, using a third window without coordination with the OS leads to another problem. That is, when your mappings and the system's result in a one-to-many map from the pci back to memory. Bad things will happen... If you go down this path, be aware that you are tied to cpu versions, chip sets, os versions, platform design, memory size, etc. A real support nightmare. m -- Monty Brandenberg, Software Consultant MCB, Inc. mcbinc@ne.mediaone.net.MAPS.SPAM P.O. Box 426188 mcbinc@world.std.com.MAPS.SPAM Cambridge, MA 02142 617.864.6907