I have a rather unique SCSI miniport implementation I’m trying to get
working.
The actual device is a drive that connects to the PC via the serial port
(yes, it’s not exactly fast, but that’s not the point here). The drive
has it’s own communication protocol, but needs to look to the system as
if it’s a SCSI drive on a SCSI HBA.
Note that this only needs to work for Windows 2000 and XP (and beyond?).
No need to be compatible with Windoze 95/98/ME. So, I’ve broken the
rules regarding miniports and used some of the standard Windows 2000/XP
kernel driver APIs, and linked to the additional libraries in my sources
file. I know that this is, shall we say, “not recommended”, but since I
have to call another driver (in this case, the serial port driver), I
need to be able to call IoCallDriver() (amoungst other APIs), so I have
to do it this way.
Since the device is actually on the serial port, I’ve used
IoGetDeviceObjectPointer() to get a pointer to the serial port’s device
object so that I can then create my own IRPs to send to it to do the low
level reads and writes to/from the hardware. Of course, since those
IRPs may complete asynchronously, I need to be able to wait until they
are completed as I send each IRP. This requires running in a thread at
PASSIVE_LEVEL so that I can perform the wait, which means I must have an
independent thread running outside of the context of the miniport
routines, since the miniport StartIo and Timer routines all run at
raised IRQL under locks. And since the miniport does not handle the
serial interrupt itself, I can’t use a miniport interrupt routine for
notification of the completion of each IRP sent to the serial port. So
I’ve created an independent processing thread to do all of the actual
I/O processing of each SRB which uses IoBuildSynchronousFsdRequest() to
create IRPs to send the the serial port and then waits on an event for
completion.
The problem is that since this thread runs outside of the miniport
context, I have no means to call
ScsiPortNotification(RequestComplete,…) once all of the data transfer
between the PC and the drive is complete. As has been discussed on this
list in the past, calls to ScsiPortXXX functions outside of the context
of the miniport context are seemingly ignored, and thus the SRBs end up
timing out instead of being completed.
Does anybody know of a solution around this that I can make work? Other
than the SRBs timing out because I can’t complete them when I’m done,
pretty much everything else about my implementation is now working. But
I desparately need a means for somehow calling ScsiPortNotification()
(or a means to get a callback function called in miniport context) when
I complete each request.
Note that a solution bypassing the serial port driver is not desirable.
Ignoring the conflict issues, the general architecture of this driver
has to be able to support talking to other variations of my client’s
hardware that can connect to the PC by other means (parallel, add-in
card, etc.). Thus, if at all possible, a solution like I have
implemented where I am calling an underlying driver to do the actual
low-level communications with the device is desired since it is easily
modified for other underlying hardware implementations.
Any and all ideas would be greatly appreciated.
Thanks,
- Jay
Jay Talbott
Principal Consulting Engineer
SysPro Consulting, LLC
3519 E. South Fork Drive
Suite 201
Phoenix, AZ 85044
(480) 704-8045
xxxxx@sysproconsulting.com
http://www.sysproconsulting.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