MmGetPhysicalAddress function!

Hi everybody,
I have only a trivial questions… Could someone tell me if for WDM exist a
function that is equivalent with MmGetPhysicalAddress() ?

Thanks,
Ionut


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

MmGetPhysicalAddress function!The only purpose for what you need a physical address is DMA, so, use ->MapTransfer.

Max

----- Original Message -----
From: Ionut Deaconeasa
To: NT Developers Interest List
Sent: Thursday, January 10, 2002 4:54 PM
Subject: [ntdev] MmGetPhysicalAddress function!

Hi everybody,
I have only a trivial questions… Could someone tell me if for WDM exist a function that is equivalent with MmGetPhysicalAddress() ?

Thanks,
Ionut


You are currently subscribed to ntdev as: xxxxx@storagecraft.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

Hi Max,
The reason for that I need this function ( MmGetPhysicalAddress) is the
following: I wish to obtain only a physical address that will be passed to
my API where I manage some kind of “DMA” transfer. I’ve tried with
KDmaAdapter and KCommonDmaBuffer from NuMega library but unfortunately when
I try to install the driver the system will crash (not all the time - only
once from several times) because of a Page Fault error message. I allocate
all the resources from NonPagedPool but I cannot find the bug. I receive the
message when the KDmaAdapter.Initialize try to access IoGetDmaAdapter.

Greetings,
Ionut.

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Friday, January 11, 2002 8:18 AM
To: NT Developers Interest List
Subject: [ntdev] Re: MmGetPhysicalAddress function!

The only purpose for what you need a physical address is DMA, so, use
->MapTransfer.

Max

----- Original Message -----
From: Ionut Deaconeasa mailto:xxxxx
To: NT Developers Interest List mailto:xxxxx
Sent: Thursday, January 10, 2002 4:54 PM
Subject: [ntdev] MmGetPhysicalAddress function!

Hi everybody,
I have only a trivial questions… Could someone tell me if for WDM exist a
function that is equivalent with MmGetPhysicalAddress() ?

Thanks,
Ionut


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


You are currently subscribed to ntdev as: xxxxx@smi.de
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</mailto:leave-ntdev-></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

MmGetPhysicalAddress function!Nevertheless, this is a way to go. Allocate the buffer using ->AllocateCommonBuffer, and you will have both DMA and virtual addresses.
Otherwise, if you have no control on buffer allocation, use ->MapTransfer, which will give you the DMA address.

About the library - read its source carefully, using such toolkits is impossible without knowing their source well.

Max

----- Original Message -----
From: Ionut Deaconeasa
To: NT Developers Interest List
Sent: Friday, January 11, 2002 12:54 PM
Subject: [ntdev] Re: MmGetPhysicalAddress function!

Hi Max,
The reason for that I need this function ( MmGetPhysicalAddress) is the following: I wish to obtain only a physical address that will be passed to my API where I manage some kind of “DMA” transfer. I’ve tried with KDmaAdapter and KCommonDmaBuffer from NuMega library but unfortunately when I try to install the driver the system will crash (not all the time - only once from several times) because of a Page Fault error message. I allocate all the resources from NonPagedPool but I cannot find the bug. I receive the message when the KDmaAdapter.Initialize try to access IoGetDmaAdapter.

Greetings,
Ionut.
-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Friday, January 11, 2002 8:18 AM
To: NT Developers Interest List
Subject: [ntdev] Re: MmGetPhysicalAddress function!

The only purpose for what you need a physical address is DMA, so, use ->MapTransfer.

Max

----- Original Message -----
From: Ionut Deaconeasa
To: NT Developers Interest List
Sent: Thursday, January 10, 2002 4:54 PM
Subject: [ntdev] MmGetPhysicalAddress function!

Hi everybody,
I have only a trivial questions… Could someone tell me if for WDM exist a function that is equivalent with MmGetPhysicalAddress() ?

Thanks,
Ionut


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

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

You are currently subscribed to ntdev as: xxxxx@storagecraft.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

MmGetPhysicalAddress function!you can use the LogicalAddress (KCommonBuffer member) to get the physical buffer of your common buffer.
and since this buffer is contiguous u can move across it through traditional addition.

hope it help

Hesham
----- Original Message -----
From: Ionut Deaconeasa
To: NT Developers Interest List
Sent: Friday, January 11, 2002 11:54 AM
Subject: [ntdev] Re: MmGetPhysicalAddress function!

Hi Max,
The reason for that I need this function ( MmGetPhysicalAddress) is the following: I wish to obtain only a physical address that will be passed to my API where I manage some kind of “DMA” transfer. I’ve tried with KDmaAdapter and KCommonDmaBuffer from NuMega library but unfortunately when I try to install the driver the system will crash (not all the time - only once from several times) because of a Page Fault error message. I allocate all the resources from NonPagedPool but I cannot find the bug. I receive the message when the KDmaAdapter.Initialize try to access IoGetDmaAdapter.

Greetings,
Ionut.
-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Friday, January 11, 2002 8:18 AM
To: NT Developers Interest List
Subject: [ntdev] Re: MmGetPhysicalAddress function!

The only purpose for what you need a physical address is DMA, so, use ->MapTransfer.

Max

----- Original Message -----
From: Ionut Deaconeasa
To: NT Developers Interest List
Sent: Thursday, January 10, 2002 4:54 PM
Subject: [ntdev] MmGetPhysicalAddress function!

Hi everybody,
I have only a trivial questions… Could someone tell me if for WDM exist a function that is equivalent with MmGetPhysicalAddress() ?

Thanks,
Ionut


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

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

You are currently subscribed to ntdev as: xxxxx@yahoo.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

Hi Max,
Bellow you can find the fragment from my driver where the error occur (red
color). The code between /***/ is defined in OnStartDevice().
I cannot understand why IoGetDmaAdapter crash before testing the returning
pointer. I use this function to obtain only the virtual and logical address
without doing any DMA transfer. I develop a kind of API that emulates a VCR
and for this I need to find all contiguous memory from my computer. So I
only pass the memory address to my API and the rest is done at the upper
level not in the driver. So the problem with AllocateCommonBuffer work
properly in my driver, but first I must to initialize DMA_ADAPTER structure
and there I have problems. Could you tell me what is wrong with
IoGetDmaAdapter? The error appear only when I try to install the driver and
not all the time (from 20 tries only once or twice). After installing
everything works properly even if the computer will be stopped and
restarted.

DEVICE_DESCRIPTION m_dd;
PDEVICE_OBJECT Pdo;
DMA_ADAPTER *my_DmaAdapter;

unsigned long *ptr;

unsigned long k = 1;

/***/
RtlZeroMemory( &m_dd, sizeof( DEVICE_DESCRIPTION ));
m_dd.Version = DEVICE_DESCRIPTION_VERSION;
m_dd.Master = TRUE;
m_dd.ScatterGather = FALSE;
m_dd.DemandMode = FALSE;
m_dd.AutoInitialize = FALSE;
m_dd.Dma32BitAddresses = TRUE;
m_dd.IgnoreCount = FALSE;
m_dd.Reserved1 = FALSE;
m_dd.Dma64BitAddresses = FALSE;
m_dd.DmaChannel = 0;
m_dd.InterfaceType = PCIBus;
m_dd.DmaWidth = Width32Bits;
m_dd.DmaSpeed = Compatible;
m_dd.MaximumLength = 4096;

ptr = &k;
my_DmaAdapter = IoGetDmaAdapter(Pdo,&m_dd,ptr);

if(my_DmaAdapter == NULL)
{
t << “Error in IoGetDmaAdapter\n”;
}
/***/

Kind regards,
Ionut.


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

MmGetPhysicalAddress function!Set ScatterGather to TRUE and Length to (ULONG)(-1)

Max

----- Original Message -----
From: Ionut Deaconeasa
To: NT Developers Interest List
Sent: Sunday, January 13, 2002 7:33 PM
Subject: [ntdev] MmGetPhysicalAddress function!

Hi Max,
Bellow you can find the fragment from my driver where the error occur (red color). The code between /***/ is defined in OnStartDevice().

I cannot understand why IoGetDmaAdapter crash before testing the returning pointer. I use this function to obtain only the virtual and logical address without doing any DMA transfer. I develop a kind of API that emulates a VCR and for this I need to find all contiguous memory from my computer. So I only pass the memory address to my API and the rest is done at the upper level not in the driver. So the problem with AllocateCommonBuffer work properly in my driver, but first I must to initialize DMA_ADAPTER structure

and there I have problems. Could you tell me what is wrong with IoGetDmaAdapter? The error appear only when I try to install the driver and not all the time (from 20 tries only once or twice). After installing everything works properly even if the computer will be stopped and restarted.

DEVICE_DESCRIPTION m_dd;
PDEVICE_OBJECT Pdo;
DMA_ADAPTER *my_DmaAdapter;

unsigned long *ptr;

unsigned long k = 1;

/***/
RtlZeroMemory( &m_dd, sizeof( DEVICE_DESCRIPTION ));
m_dd.Version = DEVICE_DESCRIPTION_VERSION;
m_dd.Master = TRUE;
m_dd.ScatterGather = FALSE;
m_dd.DemandMode = FALSE;
m_dd.AutoInitialize = FALSE;
m_dd.Dma32BitAddresses = TRUE;
m_dd.IgnoreCount = FALSE;
m_dd.Reserved1 = FALSE;
m_dd.Dma64BitAddresses = FALSE;
m_dd.DmaChannel = 0;
m_dd.InterfaceType = PCIBus;
m_dd.DmaWidth = Width32Bits;
m_dd.DmaSpeed = Compatible;
m_dd.MaximumLength = 4096;

ptr = &k;
my_DmaAdapter = IoGetDmaAdapter(Pdo,&m_dd,ptr);

if(my_DmaAdapter == NULL)
{
t << “Error in IoGetDmaAdapter\n”;
}
/***/

Kind regards,
Ionut.


You are currently subscribed to ntdev as: xxxxx@storagecraft.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

Maxim, I’ve done the changes that you indicate to me but doesn’t work. I
still receive the message “Break due page fault” when the IoGetDmaAdapter is
called.

Thanks,
Ionut

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Monday, January 14, 2002 10:12 AM
To: NT Developers Interest List
Subject: [ntdev] Re: MmGetPhysicalAddress function!

Set ScatterGather to TRUE and Length to (ULONG)(-1)

Max

----- Original Message -----
From: Ionut Deaconeasa mailto:xxxxx
To: NT Developers Interest List mailto:xxxxx
Sent: Sunday, January 13, 2002 7:33 PM
Subject: [ntdev] MmGetPhysicalAddress function!

Hi Max,
Bellow you can find the fragment from my driver where the error occur (red
color). The code between // is defined in OnStartDevice().

I cannot understand why IoGetDmaAdapter crash before testing the returning
pointer. I use this function to obtain only the virtual and logical address
without doing any DMA transfer. I develop a kind of API that emulates a VCR
and for this I need to find all contiguous memory from my computer. So I
only pass the memory address to my API and the rest is done at the upper
level not in the driver. So the problem with AllocateCommonBuffer work
properly in my driver, but first I must to initialize DMA_ADAPTER structure

and there I have problems. Could you tell me what is wrong with
IoGetDmaAdapter? The error appear only when I try to install the driver and
not all the time (from 20 tries only once or twice). After installing
everything works properly even if the computer will be stopped and
restarted.

DEVICE_DESCRIPTION m_dd;
PDEVICE_OBJECT Pdo;
DMA_ADAPTER my_DmaAdapter;

unsigned long ptr;

unsigned long k = 1;

/
/
RtlZeroMemory( &m_dd, sizeof( DEVICE_DESCRIPTION ));
m_dd.Version = DEVICE_DESCRIPTION_VERSION;
m_dd.Master = TRUE;
m_dd.ScatterGather = FALSE;
m_dd.DemandMode = FALSE;
m_dd.AutoInitialize = FALSE;
m_dd.Dma32BitAddresses = TRUE;
m_dd.IgnoreCount = FALSE;
m_dd.Reserved1 = FALSE;
m_dd.Dma64BitAddresses = FALSE;
m_dd.DmaChannel = 0;
m_dd.InterfaceType = PCIBus;
m_dd.DmaWidth = Width32Bits;
m_dd.DmaSpeed = Compatible;
m_dd.MaximumLength = 4096;

ptr = &k;
my_DmaAdapter = IoGetDmaAdapter(Pdo,&m_dd,ptr);

if(my_DmaAdapter == NULL)
{
t << “Error in IoGetDmaAdapter\n”;
}
/
*/

Kind regards,
Ionut.


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


You are currently subscribed to ntdev as: xxxxx@smi.de
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</mailto:xxxxx></mailto:xxxxx>