SCSI Miniport Driver

Hi,

I’m new to Storage drivers. I want to know how a PNP SCSI miniport driver informs the SCSI Port driver about the presence of a device in its port. Can you give me the pointers.

Regards,
Kumar

SCSIPORT is more of a DLL than a driver and the miniport is linked to
SCSIPORT. When the SCSI miniport calls ScsiPortInitialize that dynamic link
is resolved and SCSIPORT is loaded if it was not already.

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.com
Sent: Wednesday, June 02, 2010 2:39 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] SCSI Miniport Driver

Hi,

I’m new to Storage drivers. I want to know how a PNP SCSI miniport
driver informs the SCSI Port driver about the presence of a device in its
port. Can you give me the pointers.

Regards,
Kumar


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

__________ Information from ESET Smart Security, version of virus signature
database 5164 (20100601) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature
database 5164 (20100601) __________

The message was checked by ESET Smart Security.

http://www.eset.com

Hi,

I’m confused. Whatever you mentioned that is for the Host Bus Adaptor right? Once the SCSI Port/Miniport pair is loaded for the SCSI HBA, when a device is inserted say a card, how the SCSI stack informs OS about the presence of a new device, so the the PnP manager can load the class driver for the device.

I think the SCSI port issues SCSI Inquiry command (Opcode 0x12) to enumerate devices on the HBA.

>

I’m new to Storage drivers. I want to know how a PNP SCSI miniport
driver
informs the SCSI Port driver about the presence of a device in its
port. Can
you give me the pointers.

Assuming I understand what you mean, look up “ScsiPortNotification
(NotificationType = BusChangeDetected)”

That call tells windows that devices have been added or removed from
your bus and windows will re-scan and detect the new devices.

James

Thanks. I just want to know when the port driver issues these commands. After calling DriverEntry, FindAdaptor and HwInitialize of miniport driver? When can i get these information about this information regarding port driver, i read the DDK about port driver. There is no information reg this.

If i write a virtual PnP SCSI miniport driver, can i load it as a root enumerated driver or i have to load on top of an other virtual bus driver (like toaster bus). These are discussed in another threads, but clear answer is not given.

There is a sample in recent NTInsider.

http://www.osronline.com/article.cfm?article=551

You should consider a virtual storport miniport instead.

Mark Roddy

On Wed, Jun 2, 2010 at 6:38 AM, wrote:

> Thanks. I just want to know when the port driver issues these commands.
> After calling DriverEntry, FindAdaptor and HwInitialize of miniport driver?
> When can i get these information about this information regarding port
> driver, i read the DDK about port driver. There is no information reg this.
>
> If i write a virtual PnP SCSI miniport driver, can i load it as a root
> enumerated driver or i have to load on top of an other virtual bus driver
> (like toaster bus). These are discussed in another threads, but clear answer
> is not given.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

> I’m new to Storage drivers. I want to know how a PNP SCSI miniport driver informs the SCSI Port

driver about the presence of a device in its port. Can you give me the pointers.

Port sends INQUIRY commands to miniport, miniport executes them.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

>Port/Miniport pair is loaded for the SCSI HBA, when a device is inserted say a card, how the SCSI

stack informs OS about the presence of a new device

  1. Miniport sends “bus change detected” notification to port
  2. Port re-runs INQUIRY commands for all possible bus addresses
  3. Miniport executes all these INQUIRY commands, including the one for the new device
  4. Port patches its internal child list by using the INQUIRY results, and call IoInvalidateDeviceRelations
  5. PnP sends BusRelations query to the port
  6. The port responds to this query using its internal child list


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Thanks for the information. I want to write driver on XP, so that i chosed SCSI Miniport.

In the SCSI miniport driver (InitIO, aha154x) provided by DDK (3790.1830), the above mentioned sequences (BusChangeDetected, etc) are not there. But in Storport miniport it is available. Why this is so?

How about the second question.

If i write a virtual PnP SCSI miniport driver, can i load it as a root enumerated driver or i have to load on top of an other virtual bus driver (like toaster bus). These are discussed in another threads, but clear answer is not given.

Wrong, that is a STORPORT, not a SCSIPORT, virtual driver. Virtual SCSIPORT
minport drivers are virtuall impossible, mostly because there ain’t no way
your virtual driver can acquire or queue a DPC, which means your SRB
notification is typically running at 10’s of milliseconds since your only
alternative is to use the SCSIPORT timer. You could conceivably hook, ooooo
such an ugly word, let’s say “grab” the device object pointer by creating a
left-side interface for WDM and attaching your own device object infront of
it. However, that is fairly unWHQLable. I’ve heard of one other method, that
may or may not involve grabbing that device object, but it’s under NDA and
not discussable.

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, June 02, 2010 6:02 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] SCSI Miniport Driver

There is a sample in recent NTInsider.

http://www.osronline.com/article.cfm?article=551


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

__________ Information from ESET Smart Security, version of virus signature
database 5166 (20100602) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature
database 5166 (20100602) __________

The message was checked by ESET Smart Security.

http://www.eset.com

Oh it is worse than you imagine: you have to convince scsiport that you have
bus resources on either an ISA bus or a PCI bus.

Really storport is a much better answer.

Mark Roddy

On Wed, Jun 2, 2010 at 10:44 AM, wrote:

> can i load it as a root enumerated driver

>Oh it is worse than you imagine: you have to convince scsiport that you have bus resources on >either an ISA bus or a PCI bus.
OP follows a discussion from its original post “Storage Miniport Driver” couple days ago. Calvin Guan said that he achieved to develop a virtual miniport SCSI driver. Despite on fact that such development is possible I would recommend to OP use more legitimate way to develop this type of driver for XP and early version of Windows. One way, for example, is a storage port driver. Another option is a class disk driver. At least WDK contains a sample for a disk class driver.

Igor Sharovar

Done correctly virtual SCSI miniport drivers are the optimal XP solution and get logo. There really is no better way. The problem is in order to get a good virtual SCSI miniport you need a very good engineer. Every single disadvantage people bring up is simply because they don’t know there is a better way of doing something. At the end of a project some achieve good virtual SCSI miniport solutions, but a significant others fail. It’s been this way for 10 years. How favorable people are to the approach has a lot to do with their experiences which varies a great deal.

Just reading the first 2 words of the first post “I’m new” it seems the OP is in way over his head. This is a very tough job to get right, even tougher than a file system filter. Keep asking lots of questions, but I fear you will ultimately fall into the “avoid this approach” group.

Actually we are not bothering about the WHQL certification and performance also not an issue. We are going to simulate a SCSI controller virtually. So we are going for virtual SCSI miniport. I’ve read the overheads regarding this in other posts, but i learnt that its possible to implement a virtual scsi port. But still no other go.

Thats why i gone through SCSI miniport drivers and i’ve that doubts. I’m really not able to find the things in SCSI miniport driver about indicating the port driver regarding child device.

>I’m really not able to find the things in SCSI miniport driver about indicating the port driver >regarding child device.
The problem is that you need to have a bus driver which would enumerate your device and you need to fake a SCSI Port driver transferring to it a PnP message indicating that a PCI device found and PCI resources is assigned. This work is required a significant reverse engineering effort.

Igor Sharovar

The problem is that the OP is really not looking very hard.
ScsiportNotification type BusChangeDetected will convince the port driver to
redo the inquiry based bus enumeration.

Mark Roddy

On Thu, Jun 3, 2010 at 12:14 PM, wrote:

> >I’m really not able to find the things in SCSI miniport driver about
> indicating the port driver >regarding child device.
> The problem is that you need to have a bus driver which would enumerate
> your device and you need to fake a SCSI Port driver transferring to it a PnP
> message indicating that a PCI device found and PCI resources is assigned.
> This work is required a significant reverse engineering effort.
>
> Igor Sharovar
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

>ScsiportNotification type BusChangeDetected will convince the port driver to redo the inquiry based >bus enumeration.
ScsiportNotification could called when a device is found and FindAdapter is called before.
FindAdapter is called when SCSIPort gets PnP messages for this device. But implementing a virtual miniport driver required a sort of bus driver which will do enumeration PCI devices. And the bus driver needs to notify StorPort driver about founded PCI devices.

Igor Sharovar

I have no idea what your first sentence means, but a miniport driver can all
ScsiportNotification type BusChangeDetected whenever it thinks the port
driver ought to redo its inquiry operations.

It is indeed a related issue as to just how the virtual scsi miniport is
going to know when a new device has arrived in order to poke the port driver
to re-enumerate, but the method for port driver re-enumeration exists in
scsiport and will work just fine once the op figures out the other half of
the problem.

Mark Roddy

On Thu, Jun 3, 2010 at 12:57 PM, wrote:

> >ScsiportNotification type BusChangeDetected will convince the port driver
> to redo the inquiry based >bus enumeration.
> ScsiportNotification could called when a device is found and FindAdapter
> is called before.
> FindAdapter is called when SCSIPort gets PnP messages for this device. But
> implementing a virtual miniport driver required a sort of bus driver which
> will do enumeration PCI devices. And the bus driver needs to notify StorPort
> driver about founded PCI devices.
>
> Igor Sharovar
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>