DispatchPnP for scsi miniport driver

In a scsi miniport driver, how do I set the pnp handle function? As in
normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone introduce
some material/books for miniport drivers? They are really hard to find.
Thanks!

The PNP handling for the SCSI miniport driver will be
done by the SCSI port driver. You can get PnP related
information from DDK documentation under Storage
Devices -> Storage Miniport Drivers -> SCSI Miniport
Drivers -> Supporting Plug and Play Devices.

— Yiping Han wrote:

> In a scsi miniport driver, how do I set the pnp
> handle function? As in
> normal drivers we use MajorFunction[IRP_MJ_PNP]? And
> can anyone introduce
> some material/books for miniport drivers? They are
> really hard to find.
> Thanks!
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR
> Online at
http://www.osronline.com/page.cfm?name=ListServer

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

In a scsi miniport driver, how do I set the pnp handle function? As
in normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
introduce some material/books for miniport drivers? They are really
hard to find. Thanks!


Questions? First check the Kernel Driver FAQ at http://www.
osronline.com/article.cfm?id=256

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

Yes. I already checked HW_INITIALIZATION_DATA, but I don’t find a callback
for pnp handling. The only information I found in Storage Devices -> Storage
Miniport Drivers -> SCSI Miniport Drivers -> Supporting Plug and Play
Devices is, you must provide HwScsiAdapterControl routine. So, how can I
response to requests like IRP_MN_REMOVE_DEVICE?

Thanks, you experts.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

In a scsi miniport driver, how do I set the pnp handle function? As
in normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
introduce some material/books for miniport drivers? They are really
hard to find. Thanks!


Questions? First check the Kernel Driver FAQ at http://www.
osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Dear Jerry,

I checked HwAdapterState, but seems this routine takes the job of saving
adapter state(as it’s name). I don’t find any info that how I can response
to those IRP_MN_XXX requests for IRP_MJ_PNP.

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

In a scsi miniport driver, how do I set the pnp handle function? As
in normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
introduce some material/books for miniport drivers? They are really
hard to find. Thanks!


Questions? First check the Kernel Driver FAQ at http://www.
osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

OOOPS! I meant to say HwAdapterControl! Sorry!
Face getting red (again).
Now hiding under desk.
Jerry.

“Yiping Han”
Sent by: xxxxx@lists.osr.com
04/20/2006 11:39 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
RE: [ntdev] DispatchPnP for scsi miniport driver

Dear Jerry,

I checked HwAdapterState, but seems this routine takes the job of saving
adapter state(as it’s name). I don’t find any info that how I can response
to those IRP_MN_XXX requests for IRP_MJ_PNP.

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

> In a scsi miniport driver, how do I set the pnp handle function? As
> in normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
> introduce some material/books for miniport drivers? They are really
> hard to find. Thanks!
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.
> osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http:
> //www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

O_O;

Jerry,

Come out of your desk please…
Wanna to ask you again. I actually checked HwAdapterControl before. I did
see it responses to the control requests for the adapter. But how can I
response to requests like IRP_MN_STOP_DEVICE for IRP_MJ_PNP like in a normal
bus driver?

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:58 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

OOOPS! I meant to say HwAdapterControl! Sorry!
Face getting red (again).
Now hiding under desk.
Jerry.

“Yiping Han”
Sent by: xxxxx@lists.osr.com
04/20/2006 11:39 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
RE: [ntdev] DispatchPnP for scsi miniport driver

Dear Jerry,

I checked HwAdapterState, but seems this routine takes the job of saving
adapter state(as it’s name). I don’t find any info that how I can response
to those IRP_MN_XXX requests for IRP_MJ_PNP.

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

> In a scsi miniport driver, how do I set the pnp handle function? As
> in normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
> introduce some material/books for miniport drivers? They are really
> hard to find. Thanks!
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.
> osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http:
> //www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

SCSIPORT takes care of handling all PNP requests for your adapter.
You’ll never see them in the miniport and don’t have to handle them.

When SCSIPORT gets a PNP request it turns this into several calls into
the miniport. A first-time IRP_MN_START_DEVICE becomes
HwScsiFindAdapter & HwScsiInitialize. Once the adapter is running, a
stop and restart or a removal will all go thorugh HwScsiAdapterControl.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yiping Han
Sent: Thursday, April 20, 2006 9:16 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

O_O;

Jerry,

Come out of your desk please…
Wanna to ask you again. I actually checked HwAdapterControl before. I
did see it responses to the control requests for the adapter. But how
can I response to requests like IRP_MN_STOP_DEVICE for IRP_MJ_PNP like
in a normal bus driver?

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:58 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

OOOPS! I meant to say HwAdapterControl! Sorry!
Face getting red (again).
Now hiding under desk.
Jerry.

“Yiping Han” Sent by:
xxxxx@lists.osr.com
04/20/2006 11:39 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
RE: [ntdev] DispatchPnP for scsi miniport driver

Dear Jerry,

I checked HwAdapterState, but seems this routine takes the job of saving
adapter state(as it’s name). I don’t find any info that how I can
response
to those IRP_MN_XXX requests for IRP_MJ_PNP.

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

> In a scsi miniport driver, how do I set the pnp handle function? As
> in normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
> introduce some material/books for miniport drivers? They are really
> hard to find. Thanks!
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.
> osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http:
> //www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

SCSIPORT already does it for you. Are you not satisfied with it?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Yiping Han”
To: “Windows System Software Devs Interest List”
Sent: Thursday, April 20, 2006 6:59 PM
Subject: [ntdev] DispatchPnP for scsi miniport driver

> In a scsi miniport driver, how do I set the pnp handle function? As in
> normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone introduce
> some material/books for miniport drivers? They are really hard to find.
> Thanks!
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

See the ddk section titled “Supporting Plug and Play in a SCSI
Miniport”. The only PnP operations the miniport is involved in get to
your miniport driver through your HwScsiAdapterControl method. For
information on implementing this method see “SCSI Miniport Driver’s
HwScsiAdapterControl Routine”.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yiping Han
Sent: Thursday, April 20, 2006 12:16 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

O_O;

Jerry,

Come out of your desk please…
Wanna to ask you again. I actually checked HwAdapterControl before. I
did
see it responses to the control requests for the adapter. But how can I
response to requests like IRP_MN_STOP_DEVICE for IRP_MJ_PNP like in a
normal
bus driver?

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:58 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

OOOPS! I meant to say HwAdapterControl! Sorry!
Face getting red (again).
Now hiding under desk.
Jerry.

“Yiping Han”
Sent by: xxxxx@lists.osr.com
04/20/2006 11:39 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
RE: [ntdev] DispatchPnP for scsi miniport driver

Dear Jerry,

I checked HwAdapterState, but seems this routine takes the job of saving
adapter state(as it’s name). I don’t find any info that how I can
response
to those IRP_MN_XXX requests for IRP_MJ_PNP.

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

> In a scsi miniport driver, how do I set the pnp handle function? As
> in normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
> introduce some material/books for miniport drivers? They are really
> hard to find. Thanks!
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.
> osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http:
> //www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

> Yes. I already checked HW_INITIALIZATION_DATA, but I don’t find a callback

for pnp handling. The only information I found in Storage Devices -> Storage
Miniport Drivers -> SCSI Miniport Drivers -> Supporting Plug and Play
Devices is, you must provide HwScsiAdapterControl routine. So, how can I
response to requests like IRP_MN_REMOVE_DEVICE?

You do not need to do this. SCSIPORT does all of this for you, it has some
default code to handle MJ_PNP. I think that there are no ways for a miniport to
customize it.

The similar picture is with MJ_POWER, but the miniport’s HwScsiAdapterControl
can provide a mean of customizing the SCSIPORT’s power management handler.

Also some of this stuff is done declaratively by filling some fields in
HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Thank Peter. The things are getting much clearer. Another question is, how
can I tell if a scsi miniport driver support PnP? If it has the
HwScsiAdapterControl routing or not?

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Thursday, April 20, 2006 12:44 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

SCSIPORT takes care of handling all PNP requests for your adapter.
You’ll never see them in the miniport and don’t have to handle them.

When SCSIPORT gets a PNP request it turns this into several calls into
the miniport. A first-time IRP_MN_START_DEVICE becomes
HwScsiFindAdapter & HwScsiInitialize. Once the adapter is running, a
stop and restart or a removal will all go thorugh HwScsiAdapterControl.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yiping Han
Sent: Thursday, April 20, 2006 9:16 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

O_O;

Jerry,

Come out of your desk please…
Wanna to ask you again. I actually checked HwAdapterControl before. I
did see it responses to the control requests for the adapter. But how
can I response to requests like IRP_MN_STOP_DEVICE for IRP_MJ_PNP like
in a normal bus driver?

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:58 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

OOOPS! I meant to say HwAdapterControl! Sorry!
Face getting red (again).
Now hiding under desk.
Jerry.

“Yiping Han” Sent by:
xxxxx@lists.osr.com
04/20/2006 11:39 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
RE: [ntdev] DispatchPnP for scsi miniport driver

Dear Jerry,

I checked HwAdapterState, but seems this routine takes the job of saving
adapter state(as it’s name). I don’t find any info that how I can
response
to those IRP_MN_XXX requests for IRP_MJ_PNP.

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

> In a scsi miniport driver, how do I set the pnp handle function? As
> in normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
> introduce some material/books for miniport drivers? They are really
> hard to find. Thanks!
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.
> osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http:
> //www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

> can I tell if a scsi miniport driver support PnP?

By not filling the hardware resource fields (access ranges) in
HwScsiFindAdapter.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Basically, the thing I want to do is like this. I took over a project. We
have a scsi miniport driver for virtual scsi disks here. The user level
application can enable/disable a virtual disk by sending ioctl directly into
the miniport driver. However, when user do this, a pnp manager error event
appear: device disappeared before first been prepared for removal. My
understanding is, since the scsi driver removes the disk in its own list
directly, the pnp manager is notified with what happens. So, I found that I
might be able to use IoInvaliadteDeviceRelations() to let the pnp manager
know. By this, I suppose I should response to IRP_MN_QUER_DEVICE_RELATIONS
as from what I read.

Another thing is, honestly I’m not very sure if the driver is PnP. I did see
it has HwAdapterControl so I suppose it is PnP driver.

I’m now ok with normal drivers, but for miniport, there’s too little
information so I don’t know how to do it. Please give advice for what I try
to do and please forgive my ignorance if there’s anything wrong in my
words:-)

– Yiping
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Thursday, April 20, 2006 1:08 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

SCSIPORT already does it for you. Are you not satisfied with it?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Yiping Han”
To: “Windows System Software Devs Interest List”
Sent: Thursday, April 20, 2006 6:59 PM
Subject: [ntdev] DispatchPnP for scsi miniport driver

> In a scsi miniport driver, how do I set the pnp handle function? As in
> normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone introduce
> some material/books for miniport drivers? They are really hard to find.
> Thanks!
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

> the miniport driver. However, when user do this, a pnp manager error event

appear: device disappeared before first been prepared for removal.

If this is a disk drive - yes, correct, the cache must be flushed before.

I’m now ok with normal drivers, but for miniport, there’s too little
information so I don’t know how to do it.

If you use your own IOCTL to destroy the LUN - then yes. If you use the SetupDi
APIs to do the same (uninstall or eject device) - then you will not have any
“not prepared for removal” compains.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Maxim,

The code they did before I come use a not safe way. They try to acquire an
exclusive handle of the disk and if success, they release it and send out
the IOCTL, that’s not safe for sure.

So, I use SetupDi APIs, do I need to change anything in the miniport driver?
I just checked the code again according to your info. It seems it’s not like
a real pnp driver. So, if I just use SetupDiXXX without changing the driver,
will it work? And what’s the difference between remove and eject here?

Well, along with these questions, may I ask another question? :slight_smile: If I only
have the scsi address of the disc, how can I get the device instance ID in
user-level?

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Thursday, April 20, 2006 3:22 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

the miniport driver. However, when user do this, a pnp manager error event
appear: device disappeared before first been prepared for removal.

If this is a disk drive - yes, correct, the cache must be flushed before.

I’m now ok with normal drivers, but for miniport, there’s too little
information so I don’t know how to do it.

If you use your own IOCTL to destroy the LUN - then yes. If you use the
SetupDi
APIs to do the same (uninstall or eject device) - then you will not have any
“not prepared for removal” compains.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

That’s a good place to start.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yiping Han
Sent: Thursday, April 20, 2006 10:28 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

Thank Peter. The things are getting much clearer. Another question is,
how can I tell if a scsi miniport driver support PnP? If it has the
HwScsiAdapterControl routing or not?

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Thursday, April 20, 2006 12:44 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

SCSIPORT takes care of handling all PNP requests for your adapter.
You’ll never see them in the miniport and don’t have to handle them.

When SCSIPORT gets a PNP request it turns this into several calls into
the miniport. A first-time IRP_MN_START_DEVICE becomes
HwScsiFindAdapter & HwScsiInitialize. Once the adapter is running, a
stop and restart or a removal will all go thorugh HwScsiAdapterControl.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yiping Han
Sent: Thursday, April 20, 2006 9:16 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

O_O;

Jerry,

Come out of your desk please…
Wanna to ask you again. I actually checked HwAdapterControl before. I
did see it responses to the control requests for the adapter. But how
can I response to requests like IRP_MN_STOP_DEVICE for IRP_MJ_PNP like
in a normal bus driver?

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:58 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

OOOPS! I meant to say HwAdapterControl! Sorry!
Face getting red (again).
Now hiding under desk.
Jerry.

“Yiping Han” Sent by:
xxxxx@lists.osr.com
04/20/2006 11:39 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List” cc

Subject
RE: [ntdev] DispatchPnP for scsi miniport driver

Dear Jerry,

I checked HwAdapterState, but seems this routine takes the job of saving
adapter state(as it’s name). I don’t find any info that how I can
response to those IRP_MN_XXX requests for IRP_MJ_PNP.

– Yiping

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Thursday, April 20, 2006 11:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

See HW_INITIALIZATION_DATA, HwAdapterState function in DDK docs.
Jerry.

xxxxx@lists.osr.com wrote on 04/20/2006 10:59:00 AM:

> In a scsi miniport driver, how do I set the pnp handle function? As in

> normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
> introduce some material/books for miniport drivers? They are really
> hard to find. Thanks!
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.
> osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http:
> //www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Miniports do not get PNP events for LUNs. The PNP events they receive
are only for the adapters.

Your user-level application should probably disable the device first and
then send the I/O control to the miniport telling it to make the device
disappear.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yiping Han
Sent: Thursday, April 20, 2006 11:34 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DispatchPnP for scsi miniport driver

Basically, the thing I want to do is like this. I took over a project.
We have a scsi miniport driver for virtual scsi disks here. The user
level application can enable/disable a virtual disk by sending ioctl
directly into the miniport driver. However, when user do this, a pnp
manager error event
appear: device disappeared before first been prepared for removal. My
understanding is, since the scsi driver removes the disk in its own list
directly, the pnp manager is notified with what happens. So, I found
that I might be able to use IoInvaliadteDeviceRelations() to let the pnp
manager know. By this, I suppose I should response to
IRP_MN_QUER_DEVICE_RELATIONS as from what I read.

Another thing is, honestly I’m not very sure if the driver is PnP. I did
see it has HwAdapterControl so I suppose it is PnP driver.

I’m now ok with normal drivers, but for miniport, there’s too little
information so I don’t know how to do it. Please give advice for what I
try to do and please forgive my ignorance if there’s anything wrong in
my
words:-)

– Yiping
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, April 20, 2006 1:08 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DispatchPnP for scsi miniport driver

SCSIPORT already does it for you. Are you not satisfied with it?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Yiping Han”
To: “Windows System Software Devs Interest List”
Sent: Thursday, April 20, 2006 6:59 PM
Subject: [ntdev] DispatchPnP for scsi miniport driver

> In a scsi miniport driver, how do I set the pnp handle function? As in
> normal drivers we use MajorFunction[IRP_MJ_PNP]? And can anyone
introduce
> some material/books for miniport drivers? They are really hard to
find.
> Thanks!
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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