Virtual Scsi Miniport Question

Let me simmer for a bit before I get to my question. I have a SCSI virtual
port driver written. Problem I have is that I cannot create crash dumps or
write to a hibernate file because I do not know the interface between the OS
and Microsoft’s port driver in DriverEntry(someone in this newsgroup has
told me it’s NDA material, don’t know why but it is). I need hibernate
support for my product. So my choices are the following:

  1. Shell out money to look at the source code to look at this interface
    (That’s not going to happen).
  2. Redo my port driver as a virtual miniport driver. (I really don’t want to
    do this).
  3. Contract this work out to someone who knows how the interface works
    (Don’t know if that’s possible) and put it into to our existing port driver.

Well I’m trying 2, so here goes with my question.
Can I create a virtual PnP SCSI adapter device? I have created a child PDO
to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns LegacyBusType
= Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
SCSI miniport driver using the appropriate methods: the “source” file has
TARGETTYPE= MINIPORT, I’m not linking in any external function calls yet
(like hal.lib, etc). I’m using scsiport.lib, nothing else. The device is
enumerated and seen by the OS, My INF file and driver are used to update
the driver through Device Manager. The INF file and driver are seen as an
appropriate match for the enumerated PDO device. The OS begins to install
the driver but immediately returns an error with the following, “The driver
selected for this device does not support Windows 2000”. I hooked up the
debugger and the only thing written to the debug console is the following:
“A SCSI driver is not a Win NTdriver.” Not sure who spit this out since no
driver name is next to the statement in the debug console. Not sure what’s
going on here.

Thanks In Advance,
Joe

“Joe Moriarty” wrote in message
news:xxxxx@ntdev…

[snip]

> selected for this device does not support Windows 2000". I hooked up the
> debugger and the only thing written to the debug console is the following:
> “A SCSI driver is not a Win NTdriver.” Not sure who spit this out since
no
> driver name is next to the statement in the debug console. Not sure
what’s
> going on here.

Use Windbg to bp on DbgPrint. That will show you who’s writing that
message.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
E-mail address is pointed at a domain squatter. Use reply-to instead.

Thanks Phil for the reply.

Tried the bp on DebugPrint. It flew right by the breakpoint.

Joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Phil Barila
Sent: Friday, September 27, 2002 11:07 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Virtual Scsi Miniport Question

“Joe Moriarty” wrote in message
> news:xxxxx@ntdev…
>
> [snip]
>
> > selected for this device does not support Windows 2000". I
> hooked up the
> > debugger and the only thing written to the debug console is the
> following:
> > “A SCSI driver is not a Win NTdriver.” Not sure who spit this out since
> no
> > driver name is next to the statement in the debug console. Not sure
> what’s
> > going on here.
>
> Use Windbg to bp on DbgPrint. That will show you who’s writing that
> message.
>
> Phil
> –
> Philip D. Barila
> Seagate Technology, LLC
> (720) 684-1842
> E-mail address is pointed at a domain squatter. Use reply-to instead.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@east.sun.com
> To unsubscribe send a blank email to %%email.unsub%%

“Joe Moriarty” wrote in message
news:xxxxx@ntdev…
>
> Thanks Phil for the reply.
>
> Tried the bp on DebugPrint. It flew right by the breakpoint.
>
> Joe

DebugPrint isn’t the kernel routine. DbgPrint is.

Phil


Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
E-mail address is pointed at a domain squatter. Use reply-to instead.

I think this print indicates that there is a problem with your INF file
(something like the .services section doesn’t exist). Did you run your INF
file through chkinf?

/simgr

-----Original Message-----
From: Joe Moriarty [mailto:xxxxx@east.sun.com]
Sent: Friday, September 27, 2002 10:55 AM
To: NT Developers Interest List
Subject: [ntdev] Virtual Scsi Miniport Question

Let me simmer for a bit before I get to my question. I have a SCSI virtual
port driver written. Problem I have is that I cannot create crash dumps or
write to a hibernate file because I do not know the interface between the OS
and Microsoft’s port driver in DriverEntry(someone in this newsgroup has
told me it’s NDA material, don’t know why but it is). I need hibernate
support for my product. So my choices are the following:

  1. Shell out money to look at the source code to look at this interface
    (That’s not going to happen).
  2. Redo my port driver as a virtual miniport driver. (I really don’t want to
    do this).
  3. Contract this work out to someone who knows how the interface works
    (Don’t know if that’s possible) and put it into to our existing port driver.

Well I’m trying 2, so here goes with my question.
Can I create a virtual PnP SCSI adapter device? I have created a child PDO
to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns LegacyBusType
= Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
SCSI miniport driver using the appropriate methods: the “source” file has
TARGETTYPE= MINIPORT, I’m not linking in any external function calls yet
(like hal.lib, etc). I’m using scsiport.lib, nothing else. The device is
enumerated and seen by the OS, My INF file and driver are used to update
the driver through Device Manager. The INF file and driver are seen as an
appropriate match for the enumerated PDO device. The OS begins to install
the driver but immediately returns an error with the following, “The driver
selected for this device does not support Windows 2000”. I hooked up the
debugger and the only thing written to the debug console is the following:
“A SCSI driver is not a Win NTdriver.” Not sure who spit this out since no
driver name is next to the statement in the debug console. Not sure what’s
going on here.

Thanks In Advance,
Joe


You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to %%email.unsub%%

My bad on the typo. I meant DbgPrint. In any rate, same as before.
Flying right by. I even did a

x nt!DbgPrint

to get the address. I set a breakpoint on the address and the same thing
occurred. Nothing. Flying right by.

Joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Phil Barila
Sent: Friday, September 27, 2002 11:33 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Virtual Scsi Miniport Question

“Joe Moriarty” wrote in message
> news:xxxxx@ntdev…
> >
> > Thanks Phil for the reply.
> >
> > Tried the bp on DebugPrint. It flew right by the breakpoint.
> >
> > Joe
>
> DebugPrint isn’t the kernel routine. DbgPrint is.
>
> Phil
>
> –
> Philip D. Barila
> Seagate Technology, LLC
> (720) 684-1842
> E-mail address is pointed at a domain squatter. Use reply-to instead.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@east.sun.com
> To unsubscribe send a blank email to %%email.unsub%%

Simon,

Give that man the prize. Typo in my INF file in the services section. I
fixed the typo and it fixed my problem.

I still would like to have the interface the SCSIPORT driver uses to create
the hibernate file, and crash dump file. I would appreciate it if the
developers at Microsoft get this message. This is very important for a
developer to have knowledge about. Especially when having to create your
own SCSIPORT driver because we all know that writing a virtual scsi miniport
driver is not a viable option. Even when you are forced to do it for
something like the problem I am trying to solve.

Can’t wait to see how bad the performance is.

Thanks,
Joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Graham, Simon
Sent: Friday, September 27, 2002 11:47 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Virtual Scsi Miniport Question

I think this print indicates that there is a problem with your INF file
(something like the .services section doesn’t exist). Did you run your INF
file through chkinf?

/simgr

-----Original Message-----
From: Joe Moriarty [mailto:xxxxx@east.sun.com]
Sent: Friday, September 27, 2002 10:55 AM
To: NT Developers Interest List
Subject: [ntdev] Virtual Scsi Miniport Question

Let me simmer for a bit before I get to my question. I have a
SCSI virtual
port driver written. Problem I have is that I cannot create
crash dumps or
write to a hibernate file because I do not know the interface
between the OS
and Microsoft’s port driver in DriverEntry(someone in this newsgroup has
told me it’s NDA material, don’t know why but it is). I need hibernate
support for my product. So my choices are the following:

  1. Shell out money to look at the source code to look at this interface
    (That’s not going to happen).
  2. Redo my port driver as a virtual miniport driver. (I really
    don’t want to
    do this).
  3. Contract this work out to someone who knows how the interface works
    (Don’t know if that’s possible) and put it into to our existing
    port driver.

Well I’m trying 2, so here goes with my question.
Can I create a virtual PnP SCSI adapter device? I have created a
child PDO
to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
LegacyBusType
= Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
SCSI miniport driver using the appropriate methods: the “source” file has
TARGETTYPE= MINIPORT, I’m not linking in any external function calls yet
(like hal.lib, etc). I’m using scsiport.lib, nothing else. The device is
enumerated and seen by the OS, My INF file and driver are used to update
the driver through Device Manager. The INF file and driver are seen as an
appropriate match for the enumerated PDO device. The OS begins to install
the driver but immediately returns an error with the following,
“The driver
selected for this device does not support Windows 2000”. I hooked up the
debugger and the only thing written to the debug console is the following:
“A SCSI driver is not a Win NTdriver.” Not sure who spit this
out since no
driver name is next to the statement in the debug console. Not
sure what’s
going on here.

Thanks In Advance,
Joe


You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@east.sun.com
To unsubscribe send a blank email to %%email.unsub%%

DUMP_POINTERS?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Joe Moriarty
Sent: Friday, September 27, 2002 7:55 AM
To: NT Developers Interest List
Subject: [ntdev] Virtual Scsi Miniport Question

Let me simmer for a bit before I get to my question. I have a SCSI
virtual
port driver written. Problem I have is that I cannot create crash dumps
or
write to a hibernate file because I do not know the interface between
the OS
and Microsoft’s port driver in DriverEntry(someone in this newsgroup has
told me it’s NDA material, don’t know why but it is). I need hibernate
support for my product. So my choices are the following:

  1. Shell out money to look at the source code to look at this interface
    (That’s not going to happen).
  2. Redo my port driver as a virtual miniport driver. (I really don’t
    want to
    do this).
  3. Contract this work out to someone who knows how the interface works
    (Don’t know if that’s possible) and put it into to our existing port
    driver.

Well I’m trying 2, so here goes with my question.
Can I create a virtual PnP SCSI adapter device? I have created a child
PDO
to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
LegacyBusType
= Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
SCSI miniport driver using the appropriate methods: the “source” file
has
TARGETTYPE= MINIPORT, I’m not linking in any external function calls yet
(like hal.lib, etc). I’m using scsiport.lib, nothing else. The device
is
enumerated and seen by the OS, My INF file and driver are used to
update
the driver through Device Manager. The INF file and driver are seen as
an
appropriate match for the enumerated PDO device. The OS begins to
install
the driver but immediately returns an error with the following, “The
driver
selected for this device does not support Windows 2000”. I hooked up
the
debugger and the only thing written to the debug console is the
following:
“A SCSI driver is not a Win NTdriver.” Not sure who spit this out since
no
driver name is next to the statement in the debug console. Not sure
what’s
going on here.

Thanks In Advance,
Joe


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

Is this a hint? Of course the only thing I have to go on is the following.

typedef struct _DUMP_POINTERS {
struct _ADAPTER_OBJECT *AdapterObject;
PVOID MappedRegisterBase;
PVOID DumpData;
PVOID CommonBufferVa;
LARGE_INTEGER CommonBufferPa;
ULONG CommonBufferSize;
BOOLEAN AllocateCommonBuffers;
UCHAR Spare1[3];
PVOID DeviceObject;
} DUMP_POINTERS, *PDUMP_POINTERS;

So how do you fill this in for a virtual HBA driver?
How does this relate to hibernation file?

I’m really after the hibernation part, the crash dump part is just gravy.

Joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Friday, September 27, 2002 2:25 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Virtual Scsi Miniport Question

DUMP_POINTERS?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Joe Moriarty
Sent: Friday, September 27, 2002 7:55 AM
To: NT Developers Interest List
Subject: [ntdev] Virtual Scsi Miniport Question

Let me simmer for a bit before I get to my question. I have a SCSI
virtual
port driver written. Problem I have is that I cannot create crash dumps
or
write to a hibernate file because I do not know the interface between
the OS
and Microsoft’s port driver in DriverEntry(someone in this newsgroup has
told me it’s NDA material, don’t know why but it is). I need hibernate
support for my product. So my choices are the following:

  1. Shell out money to look at the source code to look at this interface
    (That’s not going to happen).
  2. Redo my port driver as a virtual miniport driver. (I really don’t
    want to
    do this).
  3. Contract this work out to someone who knows how the interface works
    (Don’t know if that’s possible) and put it into to our existing port
    driver.

Well I’m trying 2, so here goes with my question.
Can I create a virtual PnP SCSI adapter device? I have created a child
PDO
to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
LegacyBusType
= Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
SCSI miniport driver using the appropriate methods: the “source” file
has
TARGETTYPE= MINIPORT, I’m not linking in any external function calls yet
(like hal.lib, etc). I’m using scsiport.lib, nothing else. The device
is
enumerated and seen by the OS, My INF file and driver are used to
update
the driver through Device Manager. The INF file and driver are seen as
an
appropriate match for the enumerated PDO device. The OS begins to
install
the driver but immediately returns an error with the following, “The
driver
selected for this device does not support Windows 2000”. I hooked up
the
debugger and the only thing written to the debug console is the
following:
“A SCSI driver is not a Win NTdriver.” Not sure who spit this out since
no
driver name is next to the statement in the debug console. Not sure
what’s
going on here.

Thanks In Advance,
Joe


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@east.sun.com
To unsubscribe send a blank email to %%email.unsub%%

I’ll reply to what is done with the DUMP_POINTERS data structure. I do
handle this request. The only thing that is done here for virtual SCSIPORT
drivers is to return the FDO pointer of the SCSIPORT driver. That is
basically the link the OS needs to call DriverEntry of the SCSIPORT driver
during a dump to disk for either a hibernation/crash situation. Now what is
not documented and what I have been told is NDA material is the following.
When the OS calls your DriverEntry, The second parameter which is the
registry path when your driver is initialized becomes a pointer to an
undocumented data structure for doing hibernation/crash files. What it is
and how it’s used is NDA material to the normal developer. I have
everything working up to this point. This is the missing clue that needs to
be filled in for me to support hibernation/crash files on our systems. Why
it’s so important to keep from the outside world is a big mystery to me. So
in the meantime I will go onto the virtual SCSI miniport route to get around
this undocumented behavior. That’s unless someone else out their would like
to charge me a ridiculous sum of money to fill in this missing link. I’m
can be had for the right price.

Joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Joe Moriarty
Sent: Friday, September 27, 2002 2:46 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Virtual Scsi Miniport Question

Is this a hint? Of course the only thing I have to go on is the
following.

typedef struct _DUMP_POINTERS {
struct _ADAPTER_OBJECT *AdapterObject;
PVOID MappedRegisterBase;
PVOID DumpData;
PVOID CommonBufferVa;
LARGE_INTEGER CommonBufferPa;
ULONG CommonBufferSize;
BOOLEAN AllocateCommonBuffers;
UCHAR Spare1[3];
PVOID DeviceObject;
} DUMP_POINTERS, *PDUMP_POINTERS;

So how do you fill this in for a virtual HBA driver?
How does this relate to hibernation file?

I’m really after the hibernation part, the crash dump part is just gravy.

Joe

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
> Sent: Friday, September 27, 2002 2:25 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Virtual Scsi Miniport Question
>
>
> DUMP_POINTERS?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Joe Moriarty
> Sent: Friday, September 27, 2002 7:55 AM
> To: NT Developers Interest List
> Subject: [ntdev] Virtual Scsi Miniport Question
>
> Let me simmer for a bit before I get to my question. I have a SCSI
> virtual
> port driver written. Problem I have is that I cannot create crash dumps
> or
> write to a hibernate file because I do not know the interface between
> the OS
> and Microsoft’s port driver in DriverEntry(someone in this newsgroup has
> told me it’s NDA material, don’t know why but it is). I need hibernate
> support for my product. So my choices are the following:
>
> 1) Shell out money to look at the source code to look at this interface
> (That’s not going to happen).
> 2) Redo my port driver as a virtual miniport driver. (I really don’t
> want to
> do this).
> 3) Contract this work out to someone who knows how the interface works
> (Don’t know if that’s possible) and put it into to our existing port
> driver.
>
> Well I’m trying 2, so here goes with my question.
> Can I create a virtual PnP SCSI adapter device? I have created a child
> PDO
> to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
> LegacyBusType
> = Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
> SCSI miniport driver using the appropriate methods: the “source” file
> has
> TARGETTYPE= MINIPORT, I’m not linking in any external function calls yet
> (like hal.lib, etc). I’m using scsiport.lib, nothing else. The device
> is
> enumerated and seen by the OS, My INF file and driver are used to
> update
> the driver through Device Manager. The INF file and driver are seen as
> an
> appropriate match for the enumerated PDO device. The OS begins to
> install
> the driver but immediately returns an error with the following, “The
> driver
> selected for this device does not support Windows 2000”. I hooked up
> the
> debugger and the only thing written to the debug console is the
> following:
> “A SCSI driver is not a Win NTdriver.” Not sure who spit this out since
> no
> driver name is next to the statement in the debug console. Not sure
> what’s
> going on here.
>
> Thanks In Advance,
> Joe
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@east.sun.com
> To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@east.sun.com
To unsubscribe send a blank email to %%email.unsub%%

I would have to look over some old source and notes to remember exactly
how to support these files. I remember having to use the dump pointers.
I suspect Max knows :slight_smile:

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Joe Moriarty
Sent: Friday, September 27, 2002 11:46 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Virtual Scsi Miniport Question

Is this a hint? Of course the only thing I have to go on is the
following.

typedef struct _DUMP_POINTERS {
struct _ADAPTER_OBJECT *AdapterObject;
PVOID MappedRegisterBase;
PVOID DumpData;
PVOID CommonBufferVa;
LARGE_INTEGER CommonBufferPa;
ULONG CommonBufferSize;
BOOLEAN AllocateCommonBuffers;
UCHAR Spare1[3];
PVOID DeviceObject;
} DUMP_POINTERS, *PDUMP_POINTERS;

So how do you fill this in for a virtual HBA driver?
How does this relate to hibernation file?

I’m really after the hibernation part, the crash dump part is just
gravy.

Joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Friday, September 27, 2002 2:25 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Virtual Scsi Miniport Question

DUMP_POINTERS?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Joe Moriarty
Sent: Friday, September 27, 2002 7:55 AM
To: NT Developers Interest List
Subject: [ntdev] Virtual Scsi Miniport Question

Let me simmer for a bit before I get to my question. I have a SCSI
virtual
port driver written. Problem I have is that I cannot create crash
dumps
or
write to a hibernate file because I do not know the interface between
the OS
and Microsoft’s port driver in DriverEntry(someone in this newsgroup
has
told me it’s NDA material, don’t know why but it is). I need
hibernate
support for my product. So my choices are the following:

  1. Shell out money to look at the source code to look at this
    interface
    (That’s not going to happen).
  2. Redo my port driver as a virtual miniport driver. (I really don’t
    want to
    do this).
  3. Contract this work out to someone who knows how the interface works
    (Don’t know if that’s possible) and put it into to our existing port
    driver.

Well I’m trying 2, so here goes with my question.
Can I create a virtual PnP SCSI adapter device? I have created a
child
PDO
to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
LegacyBusType
= Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
SCSI miniport driver using the appropriate methods: the “source” file
has
TARGETTYPE= MINIPORT, I’m not linking in any external function calls
yet
(like hal.lib, etc). I’m using scsiport.lib, nothing else. The
device
is
enumerated and seen by the OS, My INF file and driver are used to
update
the driver through Device Manager. The INF file and driver are seen
as
an
appropriate match for the enumerated PDO device. The OS begins to
install
the driver but immediately returns an error with the following, “The
driver
selected for this device does not support Windows 2000”. I hooked up
the
debugger and the only thing written to the debug console is the
following:
“A SCSI driver is not a Win NTdriver.” Not sure who spit this out
since
no
driver name is next to the statement in the debug console. Not sure
what’s
going on here.

Thanks In Advance,
Joe


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@east.sun.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

IIRC w2k uses special hack for dump path miniport driver. It creates
another driver object with the name of “dump_xxx”, and loads the same
miniport binary second time
to be used for dumps only.

Max

----- Original Message -----
From: “Joe Moriarty”
To: “NT Developers Interest List”
Sent: Friday, September 27, 2002 10:45 PM
Subject: [ntdev] RE: Virtual Scsi Miniport Question

> Is this a hint? Of course the only thing I have to go on is the
following.
>
> typedef struct _DUMP_POINTERS {
> struct _ADAPTER_OBJECT *AdapterObject;
> PVOID MappedRegisterBase;
> PVOID DumpData;
> PVOID CommonBufferVa;
> LARGE_INTEGER CommonBufferPa;
> ULONG CommonBufferSize;
> BOOLEAN AllocateCommonBuffers;
> UCHAR Spare1[3];
> PVOID DeviceObject;
> } DUMP_POINTERS, *PDUMP_POINTERS;
>
> So how do you fill this in for a virtual HBA driver?
> How does this relate to hibernation file?
>
> I’m really after the hibernation part, the crash dump part is just
gravy.
>
> Joe
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
> > Sent: Friday, September 27, 2002 2:25 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: Virtual Scsi Miniport Question
> >
> >
> > DUMP_POINTERS?
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Joe Moriarty
> > Sent: Friday, September 27, 2002 7:55 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Virtual Scsi Miniport Question
> >
> > Let me simmer for a bit before I get to my question. I have a
SCSI
> > virtual
> > port driver written. Problem I have is that I cannot create crash
dumps
> > or
> > write to a hibernate file because I do not know the interface
between
> > the OS
> > and Microsoft’s port driver in DriverEntry(someone in this
newsgroup has
> > told me it’s NDA material, don’t know why but it is). I need
hibernate
> > support for my product. So my choices are the following:
> >
> > 1) Shell out money to look at the source code to look at this
interface
> > (That’s not going to happen).
> > 2) Redo my port driver as a virtual miniport driver. (I really
don’t
> > want to
> > do this).
> > 3) Contract this work out to someone who knows how the interface
works
> > (Don’t know if that’s possible) and put it into to our existing
port
> > driver.
> >
> > Well I’m trying 2, so here goes with my question.
> > Can I create a virtual PnP SCSI adapter device? I have created a
child
> > PDO
> > to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
> > LegacyBusType
> > = Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the
initial
> > SCSI miniport driver using the appropriate methods: the “source”
file
> > has
> > TARGETTYPE= MINIPORT, I’m not linking in any external function
calls yet
> > (like hal.lib, etc). I’m using scsiport.lib, nothing else. The
device
> > is
> > enumerated and seen by the OS, My INF file and driver are used to
> > update
> > the driver through Device Manager. The INF file and driver are
seen as
> > an
> > appropriate match for the enumerated PDO device. The OS begins to
> > install
> > the driver but immediately returns an error with the following,
“The
> > driver
> > selected for this device does not support Windows 2000”. I hooked
up
> > the
> > debugger and the only thing written to the debug console is the
> > following:
> > “A SCSI driver is not a Win NTdriver.” Not sure who spit this out
since
> > no
> > driver name is next to the statement in the debug console. Not
sure
> > what’s
> > going on here.
> >
> > Thanks In Advance,
> > Joe
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
xxxxx@east.sun.com
> > To unsubscribe send a blank email to %%email.unsub%%
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>

I only remember some tool from some MS tools, which was a kernel-mode
driver called “genedump”. It was shipped with .PDB, and .PDB contained
ALL internal kernel’s structures and definitions.
Since I have written a tool once to dump NuMega’s .NMS tables to a
human-readable text, I have dumped the “genedump”'s debug info. This
is from where I know the undocumented kernel’s structures.

Max

----- Original Message -----
From: “Jamey Kirby”
To: “NT Developers Interest List”
Sent: Friday, September 27, 2002 11:41 PM
Subject: [ntdev] RE: Virtual Scsi Miniport Question

> I would have to look over some old source and notes to remember
exactly
> how to support these files. I remember having to use the dump
pointers.
> I suspect Max knows :slight_smile:
>
> Jamey
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Joe Moriarty
> Sent: Friday, September 27, 2002 11:46 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Virtual Scsi Miniport Question
>
> Is this a hint? Of course the only thing I have to go on is the
> following.
>
> typedef struct _DUMP_POINTERS {
> struct _ADAPTER_OBJECT *AdapterObject;
> PVOID MappedRegisterBase;
> PVOID DumpData;
> PVOID CommonBufferVa;
> LARGE_INTEGER CommonBufferPa;
> ULONG CommonBufferSize;
> BOOLEAN AllocateCommonBuffers;
> UCHAR Spare1[3];
> PVOID DeviceObject;
> } DUMP_POINTERS, *PDUMP_POINTERS;
>
> So how do you fill this in for a virtual HBA driver?
> How does this relate to hibernation file?
>
> I’m really after the hibernation part, the crash dump part is just
> gravy.
>
> Joe
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
> > Sent: Friday, September 27, 2002 2:25 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: Virtual Scsi Miniport Question
> >
> >
> > DUMP_POINTERS?
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Joe Moriarty
> > Sent: Friday, September 27, 2002 7:55 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Virtual Scsi Miniport Question
> >
> > Let me simmer for a bit before I get to my question. I have a
SCSI
> > virtual
> > port driver written. Problem I have is that I cannot create crash
> dumps
> > or
> > write to a hibernate file because I do not know the interface
between
> > the OS
> > and Microsoft’s port driver in DriverEntry(someone in this
newsgroup
> has
> > told me it’s NDA material, don’t know why but it is). I need
> hibernate
> > support for my product. So my choices are the following:
> >
> > 1) Shell out money to look at the source code to look at this
> interface
> > (That’s not going to happen).
> > 2) Redo my port driver as a virtual miniport driver. (I really
don’t
> > want to
> > do this).
> > 3) Contract this work out to someone who knows how the interface
works
> > (Don’t know if that’s possible) and put it into to our existing
port
> > driver.
> >
> > Well I’m trying 2, so here goes with my question.
> > Can I create a virtual PnP SCSI adapter device? I have created a
> child
> > PDO
> > to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
> > LegacyBusType
> > = Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the
initial
> > SCSI miniport driver using the appropriate methods: the “source”
file
> > has
> > TARGETTYPE= MINIPORT, I’m not linking in any external function
calls
> yet
> > (like hal.lib, etc). I’m using scsiport.lib, nothing else. The
> device
> > is
> > enumerated and seen by the OS, My INF file and driver are used to
> > update
> > the driver through Device Manager. The INF file and driver are
seen
> as
> > an
> > appropriate match for the enumerated PDO device. The OS begins to
> > install
> > the driver but immediately returns an error with the following,
“The
> > driver
> > selected for this device does not support Windows 2000”. I hooked
up
> > the
> > debugger and the only thing written to the debug console is the
> > following:
> > “A SCSI driver is not a Win NTdriver.” Not sure who spit this out
> since
> > no
> > driver name is next to the statement in the debug console. Not
sure
> > what’s
> > going on here.
> >
> > Thanks In Advance,
> > Joe
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
xxxxx@east.sun.com
> > To unsubscribe send a blank email to %%email.unsub%%
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>

Joe.

Do a scan on this list for Virtual SCSI minports. The short answer is yes,
y6ou can write a virtual SCSI miniport that is driver at timer delay speeds.
if you need high data rates, but the miniport does not own the ISR you will
need to use a third party SCSI support library. Microsofts SCSIPORT and
STORPORT forces you to use an ISR or a RequestTimer call back to complete an
SRB at the end of a transfer. If the ISR us outside the perview of myour
VSMP then you have to use a timer call, incurring a quantuum delay.

Gary G. Little
Have Computer, Will Travel
909-551-2105
909-698-3191.

“Joe Moriarty” wrote in message
news:xxxxx@ntdev…
>
> Let me simmer for a bit before I get to my question. I have a SCSI
virtual
> port driver written. Problem I have is that I cannot create crash dumps
or
> write to a hibernate file because I do not know the interface between the
OS
> and Microsoft’s port driver in DriverEntry(someone in this newsgroup has
> told me it’s NDA material, don’t know why but it is). I need hibernate
> support for my product. So my choices are the following:
>
> 1) Shell out money to look at the source code to look at this interface
> (That’s not going to happen).
> 2) Redo my port driver as a virtual miniport driver. (I really don’t want
to
> do this).
> 3) Contract this work out to someone who knows how the interface works
> (Don’t know if that’s possible) and put it into to our existing port
driver.
>
> Well I’m trying 2, so here goes with my question.
> Can I create a virtual PnP SCSI adapter device? I have created a child
PDO
> to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
LegacyBusType
> = Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
> SCSI miniport driver using the appropriate methods: the “source” file has
> TARGETTYPE= MINIPORT, I’m not linking in any external function calls yet
> (like hal.lib, etc). I’m using scsiport.lib, nothing else. The device is
> enumerated and seen by the OS, My INF file and driver are used to update
> the driver through Device Manager. The INF file and driver are seen as an
> appropriate match for the enumerated PDO device. The OS begins to install
> the driver but immediately returns an error with the following, “The
driver
> selected for this device does not support Windows 2000”. I hooked up the
> debugger and the only thing written to the debug console is the following:
> “A SCSI driver is not a Win NTdriver.” Not sure who spit this out since
no
> driver name is next to the statement in the debug console. Not sure
what’s
> going on here.
>
> Thanks In Advance,
> Joe
>
>
>
>

Further … in testing three iterations of my “virtual PnP SCSI miniport”
here is what I got on a 4 stack JBOD:

RequestTimer ~ 12 MBps
Using a “Backdoor” to the SCSIPORT DPC ~ 71 MBps
Using Storage Cratfs VSPORT SCSI support library ~83.04 MBps

In comparison, QLogics miniport driver on an equivalent adapter was running
at 83.4 MBps.

Gary G. Little
Have Computer, Will Travel
909-551-2105
909-698-3191.

“Gary G. Little” wrote in message news:xxxxx@ntdev…
>
> Joe.
>
> Do a scan on this list for Virtual SCSI minports. The short answer is yes,
> y6ou can write a virtual SCSI miniport that is driver at timer delay
speeds.
> if you need high data rates, but the miniport does not own the ISR you
will
> need to use a third party SCSI support library. Microsofts SCSIPORT and
> STORPORT forces you to use an ISR or a RequestTimer call back to complete
an
> SRB at the end of a transfer. If the ISR us outside the perview of myour
> VSMP then you have to use a timer call, incurring a quantuum delay.
>
> Gary G. Little
> Have Computer, Will Travel
> 909-551-2105
> 909-698-3191.
>
> “Joe Moriarty” wrote in message
> news:xxxxx@ntdev…
> >
> > Let me simmer for a bit before I get to my question. I have a SCSI
> virtual
> > port driver written. Problem I have is that I cannot create crash dumps
> or
> > write to a hibernate file because I do not know the interface between
the
> OS
> > and Microsoft’s port driver in DriverEntry(someone in this newsgroup has
> > told me it’s NDA material, don’t know why but it is). I need hibernate
> > support for my product. So my choices are the following:
> >
> > 1) Shell out money to look at the source code to look at this interface
> > (That’s not going to happen).
> > 2) Redo my port driver as a virtual miniport driver. (I really don’t
want
> to
> > do this).
> > 3) Contract this work out to someone who knows how the interface works
> > (Don’t know if that’s possible) and put it into to our existing port
> driver.
> >
> > Well I’m trying 2, so here goes with my question.
> > Can I create a virtual PnP SCSI adapter device? I have created a child
> PDO
> > to enumerate a SCSI Adapter on a fake ISA bus (My PDO returns
> LegacyBusType
> > = Isa for IRP_MN_QUERY_BUS_INFORMATION Irp). I’ve built the initial
> > SCSI miniport driver using the appropriate methods: the “source” file
has
> > TARGETTYPE= MINIPORT, I’m not linking in any external function calls yet
> > (like hal.lib, etc). I’m using scsiport.lib, nothing else. The device
is
> > enumerated and seen by the OS, My INF file and driver are used to
update
> > the driver through Device Manager. The INF file and driver are seen as
an
> > appropriate match for the enumerated PDO device. The OS begins to
install
> > the driver but immediately returns an error with the following, “The
> driver
> > selected for this device does not support Windows 2000”. I hooked up
the
> > debugger and the only thing written to the debug console is the
following:
> > “A SCSI driver is not a Win NTdriver.” Not sure who spit this out since
> no
> > driver name is next to the statement in the debug console. Not sure
> what’s
> > going on here.
> >
> > Thanks In Advance,
> > Joe
> >
> >
> >
> >
>
>
>
>

I have a virtual SCSI miniport driver that works fine except for when the
user issues a SHUTDOWN/RESET under Win2K. I get to the “Windows is shutting
down …” and then boom. The dump is below. It doesn’t happen all the
time. I would say that in 50% of the shutdowns this will occur. The
question I have is why is the SCSIPORT driver trying to acquire the
interrupt state from the HBA? I have set the HwInterrupt routine to NULL in
my DriverEntry routine. BTW, this is a PNP virtual SCSI miniport. The
system thinks it’s on a ISA bus. I have created a bus driver that
enumerates a virtual SCSI miniport device. The SCSIPORT driver loads on top
of this stack and then calls my virtual SCSI miniport driver.

Thanks In Advance,
Joe

****************************************************************************
***
*
*
* Bugcheck Analysis
*
*
*
****************************************************************************
***

DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
An attempt was made to access a pagable (or completely invalid) address at
an
interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses.
If kernel debugger is available get stack backtrace.
Arguments:
Arg1: 00000003, memory referenced
Arg2: 00000002, IRQL
Arg3: 00000000, value 0 = read operation, 1 = write operation
Arg4: bff3a6a6, address which referenced memory

Debugging Details:

READ_ADDRESS: 00000003 Unknown

CURRENT_IRQL: 2

FAULTING_IP:
SCSIPORT!SpGetInterruptState+6e
bff3a6a6 8a5603 mov dl,[esi+0x3]

DEFAULT_BUCKET_ID: DRIVER_FAULT

BUGCHECK_STR: D1

LAST_CONTROL_TRANSFER: from 8042bcb9 to 80452e70

STACK_TEXT:
f441fb0c 8042bcb9 00000003 f441fb54 00000003
nt!RtlpBreakWithStatusInstruction
f441fb3c 8042c068 00000003 00000003 bff3a6a6 nt!KiBugCheckDebugBreak+0x31
f441fec4 80464b1f 00000000 00000003 00000002 nt!KeBugCheckEx+0x37b
f441fec4 bff3a6a6 00000000 00000003 00000002 nt!KiTrap0E+0x27c
f441ff5c bff3b636 f441ffd0 818881e4 818880e8
SCSIPORT!SpGetInterruptState+0x6e
f441ff70 bff39971 818880e8 bff3a638 f441ffd0
SCSIPORT!SpSynchronizeExecution+0x1e
f441ffe0 80460bd4 818880a4 81888030 00000000
SCSIPORT!ScsiPortCompletionDpc+0x3b
f441fff4 80403a82 f4473b9c 00000000 00000000 nt!KiRetireDpcList+0x30

FOLLOWUP_IP:
SCSIPORT!SpGetInterruptState+6e
bff3a6a6 8a5603 mov dl,[esi+0x3]

FOLLOWUP_NAME: MachineOwner

SYMBOL_NAME: SCSIPORT!SpGetInterruptState+6e

MODULE_NAME: SCSIPORT

IMAGE_NAME: SCSIPORT

STACK_COMMAND: kb

BUCKET_ID: 0xD1_SCSIPORT!SpGetInterruptState+6e

Followup: MachineOwner

SpGetInterruptState takes all the data squirreled away while the
miniport was running inside the ‘interupt spinlock’ (in your case it’s
just a normal spinlock and we synch at DPC level) and makes it safely
accessible by the completion DPC. If it’s faulting in that routine it’s
likely that something squirreled away is no longer valid - for example
you might have completed an SRB which had already been completed
earlier.

given that the SrbStatus is a one byte field at offset 3 in the SRB,
that SpGetInterruptState checks the SRB statuses while processing them,
and that the faulting address below is attempting to read a one byte
value at offset 3 from esi, I’d suspect that’s the case.

-p

-----Original Message-----
From: Joe Moriarty [mailto:xxxxx@east.sun.com]
Sent: Thursday, October 24, 2002 10:28 AM
To: NT Developers Interest List
Subject: [ntdev] Virtual SCSI miniport question

I have a virtual SCSI miniport driver that works fine except for when
the user issues a SHUTDOWN/RESET under Win2K. I get to the “Windows is
shutting down …” and then boom. The dump is below. It doesn’t happen
all the time. I would say that in 50% of the shutdowns this will occur.
The question I have is why is the SCSIPORT driver trying to acquire the
interrupt state from the HBA? I have set the HwInterrupt routine to
NULL in my DriverEntry routine. BTW, this is a PNP virtual SCSI
miniport. The system thinks it’s on a ISA bus. I have created a bus
driver that enumerates a virtual SCSI miniport device. The SCSIPORT
driver loads on top of this stack and then calls my virtual SCSI
miniport driver.

Thanks In Advance,
Joe

************************************************************************
****
***
*
*
* Bugcheck Analysis
*
*
*
************************************************************************
****
***

DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
An attempt was made to access a pagable (or completely invalid) address
at an interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses. If kernel debugger is
available get stack backtrace.
Arguments:
Arg1: 00000003, memory referenced
Arg2: 00000002, IRQL
Arg3: 00000000, value 0 = read operation, 1 = write operation
Arg4: bff3a6a6, address which referenced memory

Debugging Details:

READ_ADDRESS: 00000003 Unknown

CURRENT_IRQL: 2

FAULTING_IP:
SCSIPORT!SpGetInterruptState+6e
bff3a6a6 8a5603 mov dl,[esi+0x3]

DEFAULT_BUCKET_ID: DRIVER_FAULT

BUGCHECK_STR: D1

LAST_CONTROL_TRANSFER: from 8042bcb9 to 80452e70

STACK_TEXT:
f441fb0c 8042bcb9 00000003 f441fb54 00000003
nt!RtlpBreakWithStatusInstruction f441fb3c 8042c068 00000003 00000003
bff3a6a6 nt!KiBugCheckDebugBreak+0x31 f441fec4 80464b1f 00000000
00000003 00000002 nt!KeBugCheckEx+0x37b f441fec4 bff3a6a6 00000000
00000003 00000002 nt!KiTrap0E+0x27c f441ff5c bff3b636 f441ffd0 818881e4
818880e8 SCSIPORT!SpGetInterruptState+0x6e f441ff70 bff39971 818880e8
bff3a638 f441ffd0 SCSIPORT!SpSynchronizeExecution+0x1e
f441ffe0 80460bd4 818880a4 81888030 00000000
SCSIPORT!ScsiPortCompletionDpc+0x3b
f441fff4 80403a82 f4473b9c 00000000 00000000 nt!KiRetireDpcList+0x30

FOLLOWUP_IP:
SCSIPORT!SpGetInterruptState+6e
bff3a6a6 8a5603 mov dl,[esi+0x3]

FOLLOWUP_NAME: MachineOwner

SYMBOL_NAME: SCSIPORT!SpGetInterruptState+6e

MODULE_NAME: SCSIPORT

IMAGE_NAME: SCSIPORT

STACK_COMMAND: kb

BUCKET_ID: 0xD1_SCSIPORT!SpGetInterruptState+6e

Followup: MachineOwner


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

Put in a stub interrupt routine. HCTs will call the interrupt routine even
though you have none (at least in HCT 10).

“Joe Moriarty” wrote in message
news:xxxxx@ntdev…
>
> I have a virtual SCSI miniport driver that works fine except for when the
> user issues a SHUTDOWN/RESET under Win2K. I get to the “Windows is
shutting
> down …” and then boom. The dump is below. It doesn’t happen all the
> time. I would say that in 50% of the shutdowns this will occur. The
> question I have is why is the SCSIPORT driver trying to acquire the
> interrupt state from the HBA? I have set the HwInterrupt routine to NULL
in
> my DriverEntry routine. BTW, this is a PNP virtual SCSI miniport. The
> system thinks it’s on a ISA bus. I have created a bus driver that
> enumerates a virtual SCSI miniport device. The SCSIPORT driver loads on
top
> of this stack and then calls my virtual SCSI miniport driver.
>
> Thanks In Advance,
> Joe

Peter,

I am 100% sure you are correct. The only problem I have now is determining
which SRB I am completing twice. I have checked each and everyone of the
requests to make sure everything is correct. The only question I have now
is if I am handling the case when passing the request down to a lower level
driver.

So here is the sequence of events.

  1. SRB_FUNCTION_EXECUTE_SCSI requests comes in to my StartIo.
  2. I notify a worker thread to pass the request down to the lower level
    driver. pointer to the SRB is passed to the worker thread.
  3. I do the following before returning from my StartIo routine.
    //Adapter ready for next request.
    ScsiPortNotification(NextRequest, pAdapterExt, NULL);

I do not mark the current SRB I was working on in my StartIo as
completed, busy, etc. My guess was that this would freeze
the queue for this particular target ID. I verified this in the
debugger.

  1. Worker thread starts up and passes the SRB down to the lower level driver
    and waits on completion.
  2. Upon completion of the SRB I create the following IRP to pass to the
    SCSIPORT driver. The code is below.

PPDO_SCSI_MINIPORT_EXTENSION pPdoScsiMiniportExt;
PEMDISK_CONTROLLER_EXTENSION pEmDiskCntrlExt;
PDEVICE_EXT_HDR pPdoDevExtHdr;
PSCSI_REQUEST_BLOCK pCurrentSrb;
KEVENT kEvent;
IO_SRB_CONTROL_STRUCTURE IoCntrlStrct;
PIRP pIrp;
LARGE_INTEGER liStartingOffset;
IO_STATUS_BLOCK IoStatusBlock;
SCSI_REQUEST_BLOCK Srb;
PIO_STACK_LOCATION pIrpSp;
NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES;

pPdoScsiMiniportExt =
(PPDO_SCSI_MINIPORT_EXTENSION)pAdapterExt->pPdoScsiMiniport;
pEmDiskCntrlExt =
pPdoScsiMiniportExt->PdoDskCntrlComExt.DeviceDataExt.pEmDiskCntrlExt;
pPdoDevExtHdr =
&pPdoScsiMiniportExt->PdoDskCntrlComExt.DeviceDataExt.DeviceExtHdr;
pCurrentSrb = pAdapterExt->pCurrentSrb;

KeInitializeEvent(&kEvent, NotificationEvent, FALSE);

//
// Setup Data structure
//
RtlZeroMemory(&IoCntrlStrct, sizeof(IO_SRB_CONTROL_STRUCTURE));
IoCntrlStrct.IoSrbCntrl.HeaderLength = sizeof(SRB_IO_CONTROL);
strcpy(IoCntrlStrct.IoSrbCntrl.Signature, VER_INTERNALNAME_STR);
IoCntrlStrct.IoSrbCntrl.Timeout = FOUR_SECONDS;
IoCntrlStrct.IoSrbCntrl.ControlCode = DIO_SUNPCI_INTERMEDIATE_IO;
IoCntrlStrct.IoSrbCntrl.Length = sizeof(PSCSI_REQUEST_BLOCK);
IoCntrlStrct.pCurSrb = pCurrentSrb;

liStartingOffset.QuadPart = 1;// SCSIPORT does this, no idea why…
pIrp = IoBuildSynchronousFsdRequest(IRP_MJ_SCSI,
(PDEVICE_OBJECT)pAdapterExt->pScsiPortDevObj,
&IoCntrlStrct,
sizeof(IO_SRB_CONTROL_STRUCTURE),
&liStartingOffset, &kEvent,
&IoStatusBlock);
if(pIrp)
{
//
// Setup Irp Request Data
//
RtlZeroMemory(&Srb, sizeof(SCSI_REQUEST_BLOCK));
Srb.PathId = pCurrentSrb->PathId;
Srb.TargetId = pCurrentSrb->TargetId;
Srb.Lun = pCurrentSrb->Lun;

Srb.Function = SRB_FUNCTION_IO_CONTROL;
Srb.Length = sizeof(SCSI_REQUEST_BLOCK);
Srb.SrbFlags = SRB_FLAGS_DATA_IN | SRB_FLAGS_NO_QUEUE_FREEZE |
SRB_FLAGS_BYPASS_FROZEN_QUEUE;
Srb.DataBuffer = &IoCntrlStrct;
Srb.DataTransferLength = sizeof(IO_SRB_CONTROL_STRUCTURE);

pIrpSp = IoGetNextIrpStackLocation(pIrp);
pIrpSp->MajorFunction = IRP_MJ_SCSI;
pIrpSp->MinorFunction = 1;
pIrpSp->Parameters.Scsi.Srb = &Srb;

IoCallDriver((PDEVICE_OBJECT)pAdapterExt->pScsiPortDevObj, pIrp);
KeWaitForSingleObject(&kEvent, Executive, KernelMode, FALSE, NULL);
Status = IoStatusBlock.Status;
}
6) My StartIo routine is hit with the above IRP. I figure out that the IRP
came from my worker thread trying to complete the SRB he was working on. I
complete the request for the worker thread. I then complete the request for
worker thread IRP he sent to complete the SRB. Below is the code that does
this.

pSrbIoCntrl = (PSRB_IO_CONTROL)pSrb->DataBuffer;
if(RtlCompareMemory(pSrbIoCntrl->Signature, VER_INTERNALNAME_STR,
sizeof(pSrbIoCntrl->Signature)) ==
sizeof(pSrbIoCntrl->Signature))
{
switch(pSrbIoCntrl->ControlCode)
{
case DIO_SUNPCI_INTERMEDIATE_IO:
{
PIO_SRB_CONTROL_STRUCTURE pIoSrbCntrlStrct;

pIoSrbCntrlStrct = (PIO_SRB_CONTROL_STRUCTURE)pSrb->DataBuffer;
pCompletedSrb = pIoSrbCntrlStrct->pCurSrb;
if(pCompletedSrb)
{
// Complete the original SRB request.
ScsiPortNotification(RequestComplete, pAdapterExt,
pCompletedSrb);
}

// Set the status for the Intermediate SRB
pSrb->ScsiStatus = SCSISTAT_GOOD;
pSrb->SrbStatus = SRB_STATUS_SUCCESS;

// Complete the Intermediate SRB request.
ScsiPortNotification(RequestComplete, pAdapterExt, pSrb);
break;
}

Is this all correct?

Joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Peter Wieland
Sent: Thursday, October 24, 2002 2:43 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Virtual SCSI miniport question

SpGetInterruptState takes all the data squirreled away while the
miniport was running inside the ‘interupt spinlock’ (in your case it’s
just a normal spinlock and we synch at DPC level) and makes it safely
accessible by the completion DPC. If it’s faulting in that routine it’s
likely that something squirreled away is no longer valid - for example
you might have completed an SRB which had already been completed
earlier.

given that the SrbStatus is a one byte field at offset 3 in the SRB,
that SpGetInterruptState checks the SRB statuses while processing them,
and that the faulting address below is attempting to read a one byte
value at offset 3 from esi, I’d suspect that’s the case.

-p

-----Original Message-----
From: Joe Moriarty [mailto:xxxxx@east.sun.com]
Sent: Thursday, October 24, 2002 10:28 AM
To: NT Developers Interest List
Subject: [ntdev] Virtual SCSI miniport question

I have a virtual SCSI miniport driver that works fine except for when
the user issues a SHUTDOWN/RESET under Win2K. I get to the “Windows is
shutting down …” and then boom. The dump is below. It doesn’t happen
all the time. I would say that in 50% of the shutdowns this will occur.
The question I have is why is the SCSIPORT driver trying to acquire the
interrupt state from the HBA? I have set the HwInterrupt routine to
NULL in my DriverEntry routine. BTW, this is a PNP virtual SCSI
miniport. The system thinks it’s on a ISA bus. I have created a bus
driver that enumerates a virtual SCSI miniport device. The SCSIPORT
driver loads on top of this stack and then calls my virtual SCSI
miniport driver.

Thanks In Advance,
Joe

************************************************************************
****
***
*
*
* Bugcheck Analysis
*
*
*
************************************************************************
****
***

DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
An attempt was made to access a pagable (or completely invalid) address
at an interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses. If kernel debugger is
available get stack backtrace.
Arguments:
Arg1: 00000003, memory referenced
Arg2: 00000002, IRQL
Arg3: 00000000, value 0 = read operation, 1 = write operation
Arg4: bff3a6a6, address which referenced memory

Debugging Details:

READ_ADDRESS: 00000003 Unknown

CURRENT_IRQL: 2

FAULTING_IP:
SCSIPORT!SpGetInterruptState+6e
bff3a6a6 8a5603 mov dl,[esi+0x3]

DEFAULT_BUCKET_ID: DRIVER_FAULT

BUGCHECK_STR: D1

LAST_CONTROL_TRANSFER: from 8042bcb9 to 80452e70

STACK_TEXT:
f441fb0c 8042bcb9 00000003 f441fb54 00000003
nt!RtlpBreakWithStatusInstruction f441fb3c 8042c068 00000003 00000003
bff3a6a6 nt!KiBugCheckDebugBreak+0x31 f441fec4 80464b1f 00000000
00000003 00000002 nt!KeBugCheckEx+0x37b f441fec4 bff3a6a6 00000000
00000003 00000002 nt!KiTrap0E+0x27c f441ff5c bff3b636 f441ffd0 818881e4
818880e8 SCSIPORT!SpGetInterruptState+0x6e f441ff70 bff39971 818880e8
bff3a638 f441ffd0 SCSIPORT!SpSynchronizeExecution+0x1e
f441ffe0 80460bd4 818880a4 81888030 00000000
SCSIPORT!ScsiPortCompletionDpc+0x3b
f441fff4 80403a82 f4473b9c 00000000 00000000 nt!KiRetireDpcList+0x30

FOLLOWUP_IP:
SCSIPORT!SpGetInterruptState+6e
bff3a6a6 8a5603 mov dl,[esi+0x3]

FOLLOWUP_NAME: MachineOwner

SYMBOL_NAME: SCSIPORT!SpGetInterruptState+6e

MODULE_NAME: SCSIPORT

IMAGE_NAME: SCSIPORT

STACK_COMMAND: kb

BUCKET_ID: 0xD1_SCSIPORT!SpGetInterruptState+6e

Followup: MachineOwner


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@east.sun.com
To unsubscribe send a blank email to %%email.unsub%%

some notes:

    • this will freeze the queue for the current LUN, not the current
      target. very important distinction here. scsiport doesn’t do anything
      to track targets except as part of the bus address of the LUNs.

the code below looks okay from a quick scan, but obviously something’s
wrong with it so that “is this all correct” question is tough to answer
:slight_smile:

at the point that you crashed, ESI contains the pointer to the SRB
scsiport is processing. If you log all SRB pointers as they enter and
leave your driver you should be able to compare ESI against that log to
find out which SRB it is. Simply dumping the SRB probably won’t help
since it’s very likely been reused as a new SRB (or some other memory
allocation) by that point.

-p

-----Original Message-----
From: Joe Moriarty [mailto:xxxxx@east.sun.com]
Sent: Friday, October 25, 2002 9:11 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Virtual SCSI miniport question

Peter,

I am 100% sure you are correct. The only problem I have now is
determining which SRB I am completing twice. I have checked each and
everyone of the requests to make sure everything is correct. The only
question I have now is if I am handling the case when passing the
request down to a lower level driver.

So here is the sequence of events.

  1. SRB_FUNCTION_EXECUTE_SCSI requests comes in to my StartIo.
  2. I notify a worker thread to pass the request down to the lower level
    driver. pointer to the SRB is passed to the worker thread.
  3. I do the following before returning from my StartIo routine.
    //Adapter ready for next request.
    ScsiPortNotification(NextRequest, pAdapterExt, NULL);

I do not mark the current SRB I was working on in my StartIo as
completed, busy, etc. My guess was that this would freeze
the queue for this particular target ID. I verified this in the
debugger.

  1. Worker thread starts up and passes the SRB down to the lower level
    driver and waits on completion.
  2. Upon completion of the SRB I create the following IRP to pass to the
    SCSIPORT driver. The code is below.

PPDO_SCSI_MINIPORT_EXTENSION pPdoScsiMiniportExt;
PEMDISK_CONTROLLER_EXTENSION pEmDiskCntrlExt;
PDEVICE_EXT_HDR pPdoDevExtHdr;
PSCSI_REQUEST_BLOCK pCurrentSrb;
KEVENT kEvent;
IO_SRB_CONTROL_STRUCTURE IoCntrlStrct;
PIRP pIrp;
LARGE_INTEGER liStartingOffset;
IO_STATUS_BLOCK IoStatusBlock;
SCSI_REQUEST_BLOCK Srb;
PIO_STACK_LOCATION pIrpSp;
NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES;

pPdoScsiMiniportExt =
(PPDO_SCSI_MINIPORT_EXTENSION)pAdapterExt->pPdoScsiMiniport;
pEmDiskCntrlExt =
pPdoScsiMiniportExt->PdoDskCntrlComExt.DeviceDataExt.pEmDiskCntrlExt;
pPdoDevExtHdr =
&pPdoScsiMiniportExt->PdoDskCntrlComExt.DeviceDataExt.DeviceExtHdr;
pCurrentSrb = pAdapterExt->pCurrentSrb;

KeInitializeEvent(&kEvent, NotificationEvent, FALSE);

//
// Setup Data structure
//
RtlZeroMemory(&IoCntrlStrct, sizeof(IO_SRB_CONTROL_STRUCTURE));
IoCntrlStrct.IoSrbCntrl.HeaderLength = sizeof(SRB_IO_CONTROL);
strcpy(IoCntrlStrct.IoSrbCntrl.Signature, VER_INTERNALNAME_STR);
IoCntrlStrct.IoSrbCntrl.Timeout = FOUR_SECONDS;
IoCntrlStrct.IoSrbCntrl.ControlCode = DIO_SUNPCI_INTERMEDIATE_IO;
IoCntrlStrct.IoSrbCntrl.Length = sizeof(PSCSI_REQUEST_BLOCK);
IoCntrlStrct.pCurSrb = pCurrentSrb;

liStartingOffset.QuadPart = 1;// SCSIPORT does this, no idea why…
pIrp = IoBuildSynchronousFsdRequest(IRP_MJ_SCSI,
(PDEVICE_OBJECT)pAdapterExt->pScsiPortDevObj,
&IoCntrlStrct,
sizeof(IO_SRB_CONTROL_STRUCTURE),
&liStartingOffset, &kEvent,
&IoStatusBlock);
if(pIrp)
{
//
// Setup Irp Request Data
//
RtlZeroMemory(&Srb, sizeof(SCSI_REQUEST_BLOCK));
Srb.PathId = pCurrentSrb->PathId;
Srb.TargetId = pCurrentSrb->TargetId;
Srb.Lun = pCurrentSrb->Lun;

Srb.Function = SRB_FUNCTION_IO_CONTROL;
Srb.Length = sizeof(SCSI_REQUEST_BLOCK);
Srb.SrbFlags = SRB_FLAGS_DATA_IN | SRB_FLAGS_NO_QUEUE_FREEZE |
SRB_FLAGS_BYPASS_FROZEN_QUEUE;
Srb.DataBuffer = &IoCntrlStrct;
Srb.DataTransferLength = sizeof(IO_SRB_CONTROL_STRUCTURE);

pIrpSp = IoGetNextIrpStackLocation(pIrp);
pIrpSp->MajorFunction = IRP_MJ_SCSI;
pIrpSp->MinorFunction = 1;
pIrpSp->Parameters.Scsi.Srb = &Srb;

IoCallDriver((PDEVICE_OBJECT)pAdapterExt->pScsiPortDevObj, pIrp);
KeWaitForSingleObject(&kEvent, Executive, KernelMode, FALSE,
NULL);
Status = IoStatusBlock.Status;
}
6) My StartIo routine is hit with the above IRP. I figure out that the
IRP came from my worker thread trying to complete the SRB he was working
on. I complete the request for the worker thread. I then complete the
request for worker thread IRP he sent to complete the SRB. Below is the
code that does this.

pSrbIoCntrl = (PSRB_IO_CONTROL)pSrb->DataBuffer;
if(RtlCompareMemory(pSrbIoCntrl->Signature, VER_INTERNALNAME_STR,
sizeof(pSrbIoCntrl->Signature)) ==
sizeof(pSrbIoCntrl->Signature))
{
switch(pSrbIoCntrl->ControlCode)
{
case DIO_SUNPCI_INTERMEDIATE_IO:
{
PIO_SRB_CONTROL_STRUCTURE pIoSrbCntrlStrct;

pIoSrbCntrlStrct =
(PIO_SRB_CONTROL_STRUCTURE)pSrb->DataBuffer;
pCompletedSrb = pIoSrbCntrlStrct->pCurSrb;
if(pCompletedSrb)
{
// Complete the original SRB request.
ScsiPortNotification(RequestComplete, pAdapterExt,
pCompletedSrb);
}

// Set the status for the Intermediate SRB
pSrb->ScsiStatus = SCSISTAT_GOOD;
pSrb->SrbStatus = SRB_STATUS_SUCCESS;

// Complete the Intermediate SRB request.
ScsiPortNotification(RequestComplete, pAdapterExt, pSrb);
break;
}

Is this all correct?

Joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Peter Wieland
Sent: Thursday, October 24, 2002 2:43 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Virtual SCSI miniport question

SpGetInterruptState takes all the data squirreled away while the
miniport was running inside the ‘interupt spinlock’ (in your case it’s

just a normal spinlock and we synch at DPC level) and makes it safely
accessible by the completion DPC. If it’s faulting in that routine
it’s likely that something squirreled away is no longer valid - for
example you might have completed an SRB which had already been
completed earlier.

given that the SrbStatus is a one byte field at offset 3 in the SRB,
that SpGetInterruptState checks the SRB statuses while processing
them, and that the faulting address below is attempting to read a one
byte value at offset 3 from esi, I’d suspect that’s the case.

-p

-----Original Message-----
From: Joe Moriarty [mailto:xxxxx@east.sun.com]
Sent: Thursday, October 24, 2002 10:28 AM
To: NT Developers Interest List
Subject: [ntdev] Virtual SCSI miniport question

I have a virtual SCSI miniport driver that works fine except for when
the user issues a SHUTDOWN/RESET under Win2K. I get to the “Windows
is shutting down …” and then boom. The dump is below. It doesn’t
happen all the time. I would say that in 50% of the shutdowns this
will occur. The question I have is why is the SCSIPORT driver trying
to acquire the interrupt state from the HBA? I have set the
HwInterrupt routine to NULL in my DriverEntry routine. BTW, this is a

PNP virtual SCSI miniport. The system thinks it’s on a ISA bus. I
have created a bus driver that enumerates a virtual SCSI miniport
device. The SCSIPORT driver loads on top of this stack and then calls

my virtual SCSI miniport driver.

Thanks In Advance,
Joe

**********************************************************************
**
****
***
*
*
* Bugcheck Analysis
*
*
*

************************************************************************

****
***

DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
An attempt was made to access a pagable (or completely invalid)
address at an interrupt request level (IRQL) that is too high. This
is usually caused by drivers using improper addresses. If kernel
debugger is available get stack backtrace.
Arguments:
Arg1: 00000003, memory referenced
Arg2: 00000002, IRQL
Arg3: 00000000, value 0 = read operation, 1 = write operation
Arg4: bff3a6a6, address which referenced memory

Debugging Details:

READ_ADDRESS: 00000003 Unknown

CURRENT_IRQL: 2

FAULTING_IP:
SCSIPORT!SpGetInterruptState+6e
bff3a6a6 8a5603 mov dl,[esi+0x3]

DEFAULT_BUCKET_ID: DRIVER_FAULT

BUGCHECK_STR: D1

LAST_CONTROL_TRANSFER: from 8042bcb9 to 80452e70

STACK_TEXT:
f441fb0c 8042bcb9 00000003 f441fb54 00000003
nt!RtlpBreakWithStatusInstruction f441fb3c 8042c068 00000003 00000003
bff3a6a6 nt!KiBugCheckDebugBreak+0x31 f441fec4 80464b1f 00000000
00000003 00000002 nt!KeBugCheckEx+0x37b f441fec4 bff3a6a6 00000000
00000003 00000002 nt!KiTrap0E+0x27c f441ff5c bff3b636 f441ffd0
818881e4 818880e8 SCSIPORT!SpGetInterruptState+0x6e f441ff70 bff39971
818880e8 bff3a638 f441ffd0 SCSIPORT!SpSynchronizeExecution+0x1e
f441ffe0 80460bd4 818880a4 81888030 00000000
SCSIPORT!ScsiPortCompletionDpc+0x3b
f441fff4 80403a82 f4473b9c 00000000 00000000 nt!KiRetireDpcList+0x30

FOLLOWUP_IP:
SCSIPORT!SpGetInterruptState+6e
bff3a6a6 8a5603 mov dl,[esi+0x3]

FOLLOWUP_NAME: MachineOwner

SYMBOL_NAME: SCSIPORT!SpGetInterruptState+6e

MODULE_NAME: SCSIPORT

IMAGE_NAME: SCSIPORT

STACK_COMMAND: kb

BUCKET_ID: 0xD1_SCSIPORT!SpGetInterruptState+6e

Followup: MachineOwner


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@east.sun.com To

unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%