Does the storport's IRP_MJ_SCSI handler always call the miniport at some point?

I am trying to learn how the storage port drivers work, so i went ahead and reversed the storport!RaDriverScsiIrp (storahci miniport’s IRP_MJ_SCSI handler points to this), but this doesn’t seem to call any function inside the miniport and seems to do all the work by itself for reading the disk. but based on MSDN :

https://docs.microsoft.com/en-us/windows-hardware/drivers/storage/scsi-port-s-srb-interface-with-the-storage-class-driver

the port driver simply adds some stuff and passes the SRB to the miniport, so this is really confusing me, what does this RaDriverScsiIrp exactly do? when a storage class receives a disk read/write request, doesn’t it send it to the port driver (in this case storport) ? what happens after that, will the port driver always pass it to the miniport or…? and if the port driver always pass the SRB to the miniport after some modification, which function of miniport receives the request and how can i find the function using windbg ? ( i know miniport fills up some structures and passes them to port driver in its DriverEntry, but I’m not sure how to find the function responsible for reading/writing to disk using windbg)

Basically what I’m asking is, if everything goes well and no error occurs, will the storage port driver always call the HwStartIo provided in the HW_INITIALIZATION_DATA by the miniport driver for reading disk sectors? and how can i find this using another kernel driver, is disassembling the miniport driver’s driverEntry and finding arguments to ScsiPortInitialize/StorPortInitialize the only way or is there an easier way?

if everything goes well and no error occurs, will the storage port driver always call the HwStartIo

As opposed to what?

@Tim_Roberts said:

if everything goes well and no error occurs, will the storage port driver always call the HwStartIo

As opposed to what?

I was wondering if there is some other internal mechanism in port driver where it doesn’t always use the miniport to read the disk and has the ability to read the disk by itself in some situations?

also how can i find the address of HwStartIO using another driver? i can go as low as the port driver by going down the storage device stack, but I’m not sure how can i find the address of HwStartIO of the miniport.

where it doesn’t always use the miniport to read the disk and has the ability to read the disk by itself

Nope.

Think about that: How could it do that? The port driver doesn’t know anything about the adapter’s registers.

Peter

@“Peter_Viscarola_(OSR)” said:

where it doesn’t always use the miniport to read the disk and has the ability to read the disk by itself

Nope.

Think about that: How could it do that? The port driver doesn’t know anything about the adapter’s registers.

Peter

Thank you, yes that makes sense.

now how can i find HwStartIO of the storage miniport driver using another driver? it doesn’t seem to be exported, so what is the easiest way of finding it using another driver? is disassembling the driverEntry of miniport the only way? for example is it stored in a device extension of any device or…?

Why do you want to do this?

What bigger goal are you trying to accomplish?

Peter

@“Peter_Viscarola_(OSR)” said:
Why do you want to do this?

What bigger goal are you trying to accomplish?

Peter

Just trying to learn how storport/miniports work, so how can i find the HwStartIO of the storage stack miniport?

You already know how it works. And the entry point you’re looking for is, as you noted, not exported.

Peter