Hi All,
I am writing an experimental driver which uses the loaded ATAPort miniport. My driver will call miniport StartIo routine, the response from the device is processed in miniport ISR through ATAPort, and the complete request lands in my driver.
I want to synchronize a variable which is modified in StartIo and ISR. Tried to use KSPIN_LOCK, but it is not defined for ATAPort miniport.
I could use AtaPortRequestSynchronizedRoutine, but I want synchronization for changing only one variable and for this I do not want to make rest of the StartIo function to synchronize with ISR. Is there a way to do this?
Thanks,
Asai Thambi
if your variable type is some simple data type (like LONG, CHAR etc) you may use Interlocked*.
Interlocked* is also undefined. Including wdm.h or ntddk.h throws lot of redefinition error.
>I want to synchronize a variable which is modified in StartIo and ISR.
You need either use IDE_CHANNEL_CONFIGURATION.SyncWithIsr = TRUE or call AtaPortRequestSynchronizedRoutine from StartIO. In the first option your StartIO would be raised at DIRQL and in the second option a Synchronized routine would be run also at DIRQL.
Igor Sharovar
if possible you can also make use of the fact that word access (read/write) from
a word aligned address are atomic.
Actually, you cannot make that assumption or be sure they are atomic.
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
-----Original Message-----
From: xxxxx@yahoo.com [mailto:xxxxx@yahoo.com]
Posted At: Wednesday, June 23, 2010 2:52 PM
Posted To: ntdev
Conversation: Sync between ATAPort miniport and non-ATAport driver
Subject: RE: Sync between ATAPort miniport and non-ATAport driver
if possible you can also make use of the fact that word access
(read/write)
from a word aligned address are atomic.
__________ Information from ESET Smart Security, version of virus
signature
database 5223 (20100623) __________
The message was checked by ESET Smart Security.
http://www.eset.com
Hi Don, can you please explain why we cannot make that assumption? I understand that “compare and set” cannot be atomic this way (and hence “if possible”) but just plain read/write shall be atomic.
-
Typically, ATAport miniport StartIO routine is synchronized with ISR.
There is a field in IDE_CHANNEL_CONFIGURATION - SyncWithIsr controls this
behavior. By default, ATAport sets it to ‘TRUE’. Unless a miniport driver
changes it to ‘FALSE’, you will not have sync issue between StartIo and ISR.
Refer to: http://msdn.microsoft.com/en-us/library/ff567607(VS.85).aspx
-
What’s the thought to invoke a miniport routine directly? If you want to
pass down a specific command, IOCTL_ATA_PASS_THROUGH(_DIRECT) might be an
option.
-Michael Xing
wrote in message news:xxxxx@ntdev…
Hi All,
I am writing an experimental driver which uses the loaded ATAPort miniport.
My driver will call miniport StartIo routine, the response from the device
is processed in miniport ISR through ATAPort, and the complete request lands
in my driver.
I want to synchronize a variable which is modified in StartIo and ISR. Tried
to use KSPIN_LOCK, but it is not defined for ATAPort miniport.
I could use AtaPortRequestSynchronizedRoutine, but I want synchronization
for changing only one variable and for this I do not want to make rest of
the StartIo function to synchronize with ISR. Is there a way to do this?
Thanks,
Asai Thambi