Specify the destination of a DMA transfer

Hi all,

I use WriteFile user mode function to initiate a DMA transfer from PC memory into device’s memory.
How can I specify an additional parameter: transfer’s destination? Include the transfer’s destination in
first 4 bytes of the buffer sent down to my driver is not appropriate in my case.

any idea is welcome.

Thanks in advance,
Daniel


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi ALL!

I have a board with a MPC8240 processor on it. The processor is set to host mode.

I try to use DMA facilities of MPC8240 for transfering blocks of memory from PC’s

RAM memory into my board’s RAM. I programmed MPC8240 for PCI-to-local DMA

transfer and I get a PCI error: “a master or target abort…”.

The paragraph 8.5.2.1. of the MPC8240 user manual state that:

"If the MPC8240 is in host mode and a transferred address falls within the lower 2-Gbyte

space (0x0000_0000 to 0x7FFF_FFFF) on the PCI bus (specified by CDAR[CTT]), then

the MPC8240 issues the transaction to the PCI bus with that address. However, this address

space is reserved for the host controller; therefore, no PCI target responds to the transaction,

and the transaction terminates with a PCI master abort and the PE bit in DMR is set."

WHAT do I have to do in order to transfer memory blocks from PC’s RAM to board’s RAM using MPC8240?

Hope someone can help me,

Daniel


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I can think of a couple of ways …

Use METHOD_DIRECT in the definition of an IO Control code. This gives you
the INPUT parameters as a control block and the OUTPUT parameters as a data
buffer. Alternately, use a control blocks concept that contains control
information passed to Read/WriteFile. This means the driver has to create an
MDL for the data buffer, but you then have all the parameter space you need.

Gary G. Little
Sr. Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com
xxxxx@delphieng.com

-----Original Message-----
From: Daniel Pop [mailto:xxxxx@optsol.ro]
Sent: Saturday, March 31, 2001 4:01 AM
To: NT Developers Interest List
Subject: [ntdev] Specify the destination of a DMA transfer

Hi all,

I use WriteFile user mode function to initiate a DMA transfer from PC memory
into device’s memory.
How can I specify an additional parameter: transfer’s destination? Include
the transfer’s destination in
first 4 bytes of the buffer sent down to my driver is not appropriate in my
case.

any idea is welcome.

Thanks in advance,
Daniel

You are currently subscribed to ntdev as: xxxxx@delphieng.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thank you very much.

buffer. Alternately, use a control blocks concept that contains control
information passed to Read/WriteFile. This means the driver has to create
an
MDL for the data buffer, but you then have all the parameter space you
need.

If I understood correctly, I need to:

  • pass a control block to Read/WriteFile call (the control block contains
    the user buffer address)
  • call IoAllocateMdl for the user buffer address
  • use the MDL as it were passed directly to the Read/WriteFile by NT I/O
    Manager in my DMA transfer routines
  • call IoFreeMdl at the end of the DMA transfer

Do I need to supplementary lock the user buffer or is it done by
IoAllocateMdl call?
Does this method reduce the DMA transfer performance?

Daniel


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You will need to use a try/Except block around MmProbeAndLockPages. That
call alone will lock the transferable pages into memory and will not consume
any PTEs in the process. Most likely you do not need the contents of this
data buffer, assuming everything the driver needs is contained in the
control block. If you define buffering as DO_DIRECT_IO, the control block
will then be in MdlAddress in the IRP. I define the data buffer as a
secondary buffer when I call IoAllocateMdl and let the system worry about
reallocating both MDLs when I complete the IRP.

Gary

-----Original Message-----
From: Daniel Pop [mailto:xxxxx@optsol.ro]
Sent: Monday, April 02, 2001 9:00 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Specify the destination of a DMA
transfer

Thank you very much.

buffer. Alternately, use a control blocks concept that
contains control
> information passed to Read/WriteFile. This means the
driver has to create
an
> MDL for the data buffer, but you then have all the
parameter space you
need.
>
If I understood correctly, I need to:

  • pass a control block to Read/WriteFile call (the control
    block contains
    the user buffer address)
  • call IoAllocateMdl for the user buffer address
  • use the MDL as it were passed directly to the
    Read/WriteFile by NT I/O
    Manager in my DMA transfer routines
  • call IoFreeMdl at the end of the DMA transfer

Do I need to supplementary lock the user buffer or is it
done by
IoAllocateMdl call?
Does this method reduce the DMA transfer performance?

Daniel


You are currently subscribed to ntdev as:
xxxxx@delphieng.com
To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

If you have a stand-alone or top level driver then you should be able to use
the NT API’s byteoffset information to set the target DMA position. See the
documentation for ZwWriteFile/ReadFile, the Win32 documentation for
ReadFile/WriteFile and SetFilePointerEx and look at the IO_STACK_LOCATION
definition for read/write operations and the FILE_OBJECT CurrentByteOffset
field. Filesystems have to do this sort of thing all the time, and they sure
aren’t using special IOCTLs or embedded data object pointers to do it. Worst
case is that you have to use NtReadFile/WriteFile instead of the win32
equivalents, but I doubt that.

Mark Roddy
xxxxx@hollistech.com
www.hollistech.com
603 321 1032
WindowsNT Windows 2000 Consulting Services

-----Original Message-----
From: Daniel Pop [mailto:xxxxx@optsol.ro]
Sent: Monday, April 02, 2001 12:00 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Specify the destination of a DMA transfer

Thank you very much.

buffer. Alternately, use a control blocks concept that contains control
information passed to Read/WriteFile. This means the driver has to create
an
MDL for the data buffer, but you then have all the parameter space you
need.

If I understood correctly, I need to:

  • pass a control block to Read/WriteFile call (the control block contains
    the user buffer address)
  • call IoAllocateMdl for the user buffer address
  • use the MDL as it were passed directly to the Read/WriteFile by NT I/O
    Manager in my DMA transfer routines
  • call IoFreeMdl at the end of the DMA transfer

Do I need to supplementary lock the user buffer or is it done by
IoAllocateMdl call?
Does this method reduce the DMA transfer performance?

Daniel


You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thanks a lot for ideea!

Daniel

----- Original Message -----
From: “Roddy, Mark”
To: “NT Developers Interest List”
Sent: Monday, April 02, 2001 7:54 PM
Subject: [ntdev] RE: Specify the destination of a DMA transfer

> If you have a stand-alone or top level driver then you should be able to
use
> the NT API’s byteoffset information to set the target DMA position. See
the
> documentation for ZwWriteFile/ReadFile, the Win32 documentation for
> ReadFile/WriteFile and SetFilePointerEx and look at the IO_STACK_LOCATION
> definition for read/write operations and the FILE_OBJECT CurrentByteOffset
> field. Filesystems have to do this sort of thing all the time, and they
sure
> aren’t using special IOCTLs or embedded data object pointers to do it.
Worst
> case is that you have to use NtReadFile/WriteFile instead of the win32
> equivalents, but I doubt that.
>
>
> Mark Roddy
> xxxxx@hollistech.com
> www.hollistech.com
> 603 321 1032
> WindowsNT Windows 2000 Consulting Services
>
>
>
> -----Original Message-----
> From: Daniel Pop [mailto:xxxxx@optsol.ro]
> Sent: Monday, April 02, 2001 12:00 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Specify the destination of a DMA transfer
>
>
> Thank you very much.
>
> > buffer. Alternately, use a control blocks concept that contains control
> > information passed to Read/WriteFile. This means the driver has to
create
> an
> > MDL for the data buffer, but you then have all the parameter space you
> need.
> >
> If I understood correctly, I need to:
> - pass a control block to Read/WriteFile call (the control block contains
> the user buffer address)
> - call IoAllocateMdl for the user buffer address
> - use the MDL as it were passed directly to the Read/WriteFile by NT I/O
> Manager in my DMA transfer routines
> - call IoFreeMdl at the end of the DMA transfer
>
> Do I need to supplementary lock the user buffer or is it done by
> IoAllocateMdl call?
> Does this method reduce the DMA transfer performance?
>
>
> Daniel
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@optsol.ro
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com