Hi Peter:
I agree with you guys on that. In the past I used MmXXX and it worked. But
it may not be compatible with new system. I have a couple of questions.
I wonder if one of the PCI bus is busted, all the devices including
possible the bridge node on that bus are not usable and probably removed by
PnP Manager if it detects such catastrophic event, how does it affect other
PCI devices on the PCI buses that are still accessible to the system. Will
Win2k and XP remaping the BAR for still live PCI bridges, resulting a
chained PnP events for device to get its new translated resources? I am not
sure it will do that.
Also, I don’t understand the 64-bit issue. We are not talking about 64-bit
OS. I know even 32-bit PCI bus device can be addressed in 64-bit through
dual address cycle. But the system memory cannot be addressed in 64-bit. I
think John wants to use system memory to store his scatter-gather-list
descriptor, not the hardware MMIO memory. If he writes the 32-bit system
physical address to the device register, the device will generate the
address which will be passed by PCI-to-host bridge to system memory. If he
uses hardware MMIO memory, he will use (HalTranslateBusAddress, NT 4.0)
translated address and MmMapIoSpace on the memory so the driver can write
descriptors directly to the hardware memory.
I hope you can clarify it further.
Thanks.
Bi
-----Original Message-----
From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: Thursday, September 26, 2002 2:43 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Looking for a WDM DMA Sample
MmAllocateContiguousMemorySpecifyCache will NOT do the same job.
MM is not aware of the limitations of the device or the device’s bus.
For example, on a system where one of the PCI busses is busted and
cannot be used to access data physically located above 4GB (and such
machines exist) only the HAL knows that the buffer for a device on that
bus must be located below 4GB.
if you want to do DMA then please use the DMA API.
-p
-----Original Message-----
From: Bi Chen [mailto:xxxxx@AppStream.com]
Sent: Thursday, September 26, 2002 2:14 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Looking for a WDM DMA Sample
Graham:
You are right. AllocateCommonBuffer will do the job.
MmAllocateContiguousMemorySpecifyCache will do the same job to any PCI
device because of PCI devices including PCI to host bridge use positive
decoding. It does have some platform dependence on the bus.
AllocateCommBuffer from DMA adapter object is based on the bus driver to
remove that dependence.
Bi
-----Original Message-----
From: Graham, Simon [mailto:xxxxx@stratus.com]
Sent: Thursday, September 26, 2002 1:57 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Looking for a WDM DMA Sample
Well, the answer here is to use AllocateCommonBuffer (or
HalAllocateCommonBuffer for NT4) - this allocates main memory in a way
that it can be shared with the device easily AND it returns the physical
address to hand to the device (it’s in the LogicalAddress output
parameter). Typically, one would do this allocation once (in startdevice
processing for example) and then hand the physical address to the hw.
/simgr
-----Original Message-----
From: Bi Chen [mailto:xxxxx@AppStream.com]
Sent: Thursday, September 26, 2002 4:48 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Looking for a WDM DMA Sample
Gary.
I don’t think you understand John’s problem. I think John knows how to
use DMA Adpater object. I have written many PCI bus master device
drivers to know his problem. If you read his post carefully, what he
needs to know is not how to get scatter gather list, but where to put
the descriptor that hardware understand and need to read to perform the
hardware DMA operation.
Bi
-----Original Message-----
From: Gary G. Little [mailto:xxxxx@inland.net]
Sent: Thursday, September 26, 2002 1:40 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Looking for a WDM DMA Sample
Sorry Bi, but you missed the boat.
John, go back and re-read Peter Wielands comment very carefully.
Bus Mastering Scatter-Gather DMA has been greatly simplifed in 2000 and
above. After filling in the DMA descriptor and creating a DMA adapter
object you then use the functions within that DMA adapter object to
process an MDL describing the buffer. If the kernel hands you that
buffer from user request such as a Read/WriteFile, it has been set for
system memory and all you have to do is pass each page of the buffer
through IoMapTransfer, or simply call DmaObject->GetScatterGatherList
with an MDL describing a system buffer.
Gary G. Little
909-551-2105
909-698-3191
“Bi Chen” wrote in message news:xxxxx@ntdev…
John:
If you hardware DMA engine reads directly from system memory for
scatter-gather-list descriptor, what you need is to use
MmAllocateContiguousMemorySpecifyCache for this memory instead of
allocate it from a nonpaged pool. Then you can use MmGetPhysicalAddress
to get what you want. The reason is that when you allocate the memory
from nonpaged pool, it many not be physically contiguous. But you
hardware does not know that, it keeps reading scatter-gather-list
descriptor which may be garbage if it is cross the page boundary of what
you allocated from nonpaged pool. When it DMA, it writes to arbitary
memory. Most bus master DMA use scatter-gather-list descriptor will see
a null descriptor before it stops.
This will help you.
Bi
-----Original Message-----
From: John Reilly [mailto:xxxxx@nexet.net]
Sent: Thursday, September 26, 2002 11:26 AM
To: NT Developers Interest List
Subject: [ntdev] Looking for a WDM DMA Sample
I have a busmaster radar video device. Each time the device gives me a
“I’ve got data” interrupt, I need to build a chain of DMA descriptors
telling it from whence and to where I want the data. I allocated the
descriptors from non-paged pool. I need to get the DMA chain’s address
in
such a form that, when I put that 32-bit address into a register on my
board, it can read the chain from memory and execute it.
What I’m doing now is trying to calculate the PHYSICAL_ADDRESS of the
chain. Maybe this works; I’m not sure. What I do know is that I’m
stepping all over memory and bugchecking W2k. What fun!
I’d like to find a sample WDM driver that does DMA. (Also one that does
scatter/gather would be nice.) The OSR sample doesn’t (seem to me) to
help me. And Mr Oney’s book leaves out that final step.
Any help would be appreciated. Thanks.
john.
—
You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%
—
You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%
—
You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to %%email.unsub%%
—
You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%
—
You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to %%email.unsub%%
—
You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%