Haven’t read Peter’s book (I’d be surprised if it covers much about graphics
anyways, most driver books don’t. No offense intended to Peter, I know how
many graphics chip companies there are and how many “other” chip companies
there are, and the latter is more than one order of magnitude bigger!).
Are you writing a generic driver, or something for a private purpose?
If you’re writing a generic driver, you probably can’t rely on the user
allocating the memory in a particular way, so you’d have to perform some
sort of copy at some point or another. OR just send a page at a time. This
would seem the easiest way to me.
–
Mats
-----Original Message-----
From: Daniel Luethi [mailto:xxxxx@psi.ch]
Sent: Friday, January 16, 2004 2:22 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] problems with DMA transfer with size > 4k
Dear Mat
Unfortunately our device is NOT able to perform scatter/gather which
means, there is just one TAP address (Target address pointer)
which we
hand over to our hardware. I read again in Peter Viscarolas book
carefully and with a dissapointment I think I missunderstood
the use of
map registers especially if the HAL doesn’t support hardware system
scatter/gather. In this case the HAL copies simply the memory
from the
contigous driver buffer to the paged user buffer as you said,
but this
is a big loss of performance and out of question. I wonder if I can
allocate contigous memory from user mode???
thx
Daniel
xxxxx@3Dlabs.com wrote:
> Daniel,
>
> Can’t comment on how map registers work, but thinking about
it logically:
> You HAVE to get the different mapped regions over to the
hardware. I’m not
> familiar with the exact behaviour of the calls you use, but
you should be
> able to at least figure out from the HW specs of your
device if it’s ABLE to
> take more than one address for the data to be transmitted.
If it’s only got
> ONE address register (per transfer entry), then you’d have
to make sure that
> all the data is in sequential memory, or split it into
smaller chunks.
>
> Our devices have scatter/gather mechanism, so we don’t have
to worry about
> what pages are where in memory except for the setup.
>
> Another way to do it would of course be to map a region of
memory that is
> contiguous, and then move your data from the original
location to the
> contiguous section. This would not be a performance option,
but if the
> overhead of setting up the transfer is really big, it may
be beneficial to
> do this. [If you do, you may want map this memory as
> unchachable/writecombined, unless you’re also going to read
from it, as this
> will help the performance of the system]. Note: I’m not
sure if there is a
> way to allocate memory that is contiguous.
>
> –
> Mats
>
>
>
>>-----Original Message-----
>>From: Daniel Luethi [mailto:xxxxx@psi.ch]
>>Sent: Friday, January 16, 2004 1:24 PM
>>To: Windows System Software Devs Interest List
>>Cc: xxxxx@lists.osr.com
>>Subject: Re:[ntdev] problems with DMA transfer with size > 4k
>>
>>
>>Mats
>>
>>Thanks for your answer. It seems logical what you said, but
I thought
>>these map registers kind of replacing the scatter/gather
“disability”
>>from the PCI bus master card, so that the card simply can
>>transmit with
>>an incrementing address starting with that address I got from
>>MapTransfer() even if the size is bigger than one page
(4k). Or am I
>>wrong and misunderstood the sense of these map registers completely?
>>
>>Daniel
>>
>>
>>
>>
>>
>>
>>xxxxx@3Dlabs.com wrote:
>>
>>
>>>Daniel,
>>>
>>>The PCI hard has limitations. You mention that it has no
>>
>>scatter/gather, so
>>
>>>it’s obviously your task to give it a set of pages to read
>>
>>from. If you try
>>
>>>to transfer “more than 4K”, then the second page will
>>
>>potentially be a
>>
>>>non-consecutive page, i.e. start with page 0xABCD0000, and
>>
>>second page is
>>
>>>0xBDEC4000. To transfer this, you’d have to be able to tell
>>
>>the PCI card two
>>
>>>addresses, one for each page (obviusly, one more for every
>>
>>4K transferred).
>>
>>>I’m not sure which call you use to get the list of physical
>>
>>pages, but I’m
>>
>>>sure you’ve got that covered, as your hardware must take a
>>
>>physical address
>>
>>>for the transfer.
>>>
>>>I don’t know if there is a way to allocate memory that is
>>
>>contiguously
>>
>>>mapped. If not, then you’d have to split it at every 4K boundary.
>>>
>>>There’s also the possibility that your hardware isn’t
>>
>>designed for more than
>>
>>>4K pages, so it’s counter of “how far into the page” only
>>
>>has 12-bits (or
>>
>>>less if it’s reading bigger chunks than bytes, say 10 bits
>>
>>of DWORD items).
>>
>>>There may of course be some completely different reason for
>>
>>the trouble
>>
>>>you’re seeing, but these are some ideas.
>>>
>>>–
>>>Mats
>>>
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Daniel Luethi [mailto:xxxxx@psi.ch]
>>>>Sent: Friday, January 16, 2004 12:45 PM
>>>>To: Windows System Software Devs Interest List
>>>>Subject: [ntdev] problems with DMA transfer with size > 4k
>>>>
>>>>
>>>>Hi there
>>>>
>>>>I’v got to write a WDM driver for a PCI card which is bus
>>>>master capable
>>>>but not scatter/gather. I try to follow the DMA
suggestions in the
>>>>driver books and I actually could lounge a transfer but just
>>>>with a size
>>>>less than one page. As soon as the size is bigger then one
>>>>page the data
>>>>I observe with a PCI snooper is actually sometimes the
data which I
>>>>wrote on the last DMA transfer with size under or equal to
>>>>one page size
>>>>(???). But not just the data on the secound page, oddly the
>>>>whole data
>>>>package is not the one it should be! I suspect it has to do
>>>>with the map
>>>>registers. I’m working on a x86 XP system. Could it be
that on this
>>>>system I can make no bigger DMA transfer than one page size?
>>>>Would be a
>>>>shame!
>>>>
>>>>Thanks for help
>>>>Daniel
>>>>
>>>>
>>>>—
>>>>Questions? First check the Kernel Driver FAQ at
>>>
>>>http://www.osronline.com/article.cfm?id=256
>>>
>>>You are currently subscribed to ntdev as: xxxxx@3dlabs.com
>>>To unsubscribe send a blank email to
>>
>>xxxxx@lists.osr.com
>>
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@3dlabs.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com
>
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@3dlabs.com
To unsubscribe send a blank email to xxxxx@lists.osr.com