In my SAS storport miniport driver, I am trying to write a DMA address in the StorPortHwInitialize() funtion using the StorPortWriteRegisterUlong() function and my program encounters a kernel panic.
For a little bit of background:
In HwFindAdapter routine,
I get buffer area for my device queues using StorPortGetUncachedExtension() call.
Then, get DMAAddresses for these queues using the call DMAPhysAddress StorPortConvertPhysicalAddressToUlong(StorPortGetPhysicalAddress (…))
In HwInitialize() routine,
3) I write to these DMAAddresses for the queues using StorPortWriteRegister() ?
At this time, the kernel panics. So,
Question 1) are the steps listed above correct?
Question 2) Is there a requirement of IRQL at which we can use StorPortWrite() call safely?
Question 3) In other words, is it safe to use StorPortWriteRegisteUlong() call in HwInitialize() function?
The following was my answer on the Microsoft forums for the same question,
that I posted an 1 1/2 ago:
This is not correct, if the buffer is to be used for DMA you are better off
using StorPortAllocateContiguousMemorySpecifyCacheNode() since that will
provide contiguous physical memory, and the StorPortGetUncachedExtension()
call does not.
If your device supports 64-bit addresses then you should not be using
StorPortConvertPhysicalAddressToUlong since you are truncated the upper
32-bits of the address, if it only supports 32-bit addresses for DMA then
StorPortAllocateContiguousMemorySpecifyCacheNode can allow you to allocate
memory it can access.
If the device has a 64-bit register for DMA address then use
StorPortWriteRegisterUlong64()
StorPortWriteXXX and StorPortReadXXX calls work at any IRQL.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Friday, March 16, 2018 8:16 AM
To: Windows System Software Devs Interest List Subject: [ntdev] StorportWriteRegisterUlong() function call
In my SAS storport miniport driver, I am trying to write a DMA address in the StorPortHwInitialize() funtion using the StorPortWriteRegisterUlong() function and my program encounters a kernel panic.
For a little bit of background:
In HwFindAdapter routine,
1) I get buffer area for my device queues using StorPortGetUncachedExtension() call.
2) Then, get DMAAddresses for these queues using the call DMAPhysAddress StorPortConvertPhysicalAddressToUlong(StorPortGetPhysicalAddress (…))
In HwInitialize() routine, 3) I write to these DMAAddresses for the queues using StorPortWriteRegister() ?
At this time, the kernel panics. So,
Question 1) are the steps listed above correct?
Question 2) Is there a requirement of IRQL at which we can use StorPortWrite() call safely?
Question 3) In other words, is it safe to use StorPortWriteRegisteUlong() call in HwInitialize() function?