How does Disk Class comes to know of any new disks/partitions

I am new to Storage stack.

Please forgive me if my query is too simple to ask.
As I have read in Window Internals, PartMgr.sys acts as Function for Disk
Device objects created by Disk class driver.
and PartMgr informs PnP Manager which in turn informs the Volume Managers
and so forth it propagates till creation of Volume Device Objects.
So far all clear, My doubt is how does Disk class driver come to know of
Disks below it.
I assume that Storage Miniports would inform the existence of disks to the
relevant port driver.

But still how does Disk class driver come to know of the new disk?
Does Disk class registers some callbacks with all port drivers?

If my assumption is wrong, then what is the other way through which Disk
class comes to know of the disks.

Regards
Deepak

Disk.sys is the function driver for disk pdos, so pnp does all the
work of connecting storage port driver device objects to their
appropriate class drivers.

On 4/6/09, Deepak Gupta wrote:
> I am new to Storage stack.
>
> Please forgive me if my query is too simple to ask.
> As I have read in Window Internals, PartMgr.sys acts as Function for Disk
> Device objects created by Disk class driver.
> and PartMgr informs PnP Manager which in turn informs the Volume Managers
> and so forth it propagates till creation of Volume Device Objects.
> So far all clear, My doubt is how does Disk class driver come to know of
> Disks below it.
> I assume that Storage Miniports would inform the existence of disks to the
> relevant port driver.
>
> But still how does Disk class driver come to know of the new disk?
> Does Disk class registers some callbacks with all port drivers?
>
> If my assumption is wrong, then what is the other way through which Disk
> class comes to know of the disks.
>
> Regards
> Deepak
>
> —
> 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


Mark Roddy

Deepak Gupta wrote:

Please forgive me if my query is too simple to ask.
As I have read in Window Internals, PartMgr.sys acts as Function for
Disk Device objects created by Disk class driver.
and PartMgr informs PnP Manager which in turn informs the Volume
Managers and so forth it propagates till creation of Volume Device
Objects.
So far all clear, My doubt is how does Disk class driver come to know
of Disks below it.
I assume that Storage Miniports would inform the existence of disks to
the relevant port driver.

But still how does Disk class driver come to know of the new disk?
Does Disk class registers some callbacks with all port drivers?

The key problem is that you are thinking upside down. Driver stacks in
Windows are built from the bottom up, not from the top down.

That is, you don’t start with a disk class driver, and then tell it
about new disks. Instead, everything starts at the bottom, when some
bus realizes that a new device has come online. The bus driver simply
reports the PnP identifier for the new device. The PnP subsystem then
goes to find a driver for that device. If that driver is a disk driver,
it reports the presence of a new disk (by using a PnP identifier). The
PnP subsystem will then go find a disk class driver to handle the next
layer.

If there is a partition on the disk, the disk class driver basically
reports it, which causes the partition manager to be loaded, and the
sequence continues as you have described it.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>I assume that Storage Miniports would inform the existence of disks to the relevant port driver.

Storage port driver is a PnP bus driver which has a FDO (“adapter”) and the set of PDOs off it (“LUNs”).

Some LUNs have Disk class, and Disk/ClassPnP combo is loaded as a FD for them by “GenDisk” PnP ID.

Storage ports are:

  • scsiport+miniport
  • the rather complex architecture of the ATA stack
  • storport+miniport (can be virtual)
  • usbstor
  • sbp2port
  • some 3rd party stuff


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

So from your perspective as a disk class driver, you’ll get a call to
your Pnp AddDevice function for each disk.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Monday, April 06, 2009 1:07 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How does Disk Class comes to know of any new
disks/partitions

Deepak Gupta wrote:

Please forgive me if my query is too simple to ask.
As I have read in Window Internals, PartMgr.sys acts as Function for
Disk Device objects created by Disk class driver.
and PartMgr informs PnP Manager which in turn informs the Volume
Managers and so forth it propagates till creation of Volume Device
Objects.
So far all clear, My doubt is how does Disk class driver come to know
of Disks below it.
I assume that Storage Miniports would inform the existence of disks to
the relevant port driver.

But still how does Disk class driver come to know of the new disk?
Does Disk class registers some callbacks with all port drivers?

The key problem is that you are thinking upside down. Driver stacks in
Windows are built from the bottom up, not from the top down.

That is, you don’t start with a disk class driver, and then tell it
about new disks. Instead, everything starts at the bottom, when some
bus realizes that a new device has come online. The bus driver simply
reports the PnP identifier for the new device. The PnP subsystem then
goes to find a driver for that device. If that driver is a disk driver,
it reports the presence of a new disk (by using a PnP identifier). The
PnP subsystem will then go find a disk class driver to handle the next
layer.

If there is a partition on the disk, the disk class driver basically
reports it, which causes the partition manager to be loaded, and the
sequence continues as you have described it.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


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