Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Monty Brandenberg <mcbinc.MAPS.SPAM@ne.mediaone.net>
To: apachexm@usa.net
Subject: Re: Is it able to open CIA DMA window#2 in device driver?
Date: 1998/05/21	[thread overview]
Message-ID: <3563B8A1.44A33497@ne.mediaone.net> (raw)
In-Reply-To: 6jti6j$qs6$1@nnrp1.dejanews.com


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



           reply	other threads:[~1998-05-21  4:00 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <6jti6j$qs6$1@nnrp1.dejanews.com>]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox