PCI BAR mapping

My storport based miniport driver requests for a mapping of the BAR to system virtual address space by invoking
StorPortGetDeviceBase. Now, if the server is put to into hibernation and then resumed, is it safe to assume that the the virtual
address mapped prior to hibernation is still valid after the resume. Or is it expected that the miniport requests for a re-map?

From Windbg, I see that the virtual address mapping to BAR is maintained after resume, but wanted to be sure that this is guaranteed
always.

Hardware resource assignments don’t change across S0/S4/S0 transitions, without an explicit notification of such a change.

So yes, it’s guaranteed.

Peter
OSR

Be aware, in addition, that VA to BAR mapping can and will change during PCI rebalancing events – the PnPDTest app in the WHQL test suite can test this functionality manually, but essentially (as Peter alluded to) once you get an MN_QUERY_STOP you should detach/ stop using those VA’s, once/if you get an Mx_STOP or SurpriseRemoval you should definitely stop using those VA’s until you get another Mx_START or Mx_STOP_CANCEL from PnP.

This is important because in some boxes I’ve seen S0 to S4 transitions take the PCI bridge chips offline (power saving, bad design, bad kharma, lord knows), triggering just such a PCI rebalance/ renumeration …

Ok but this is a stortport or scsiport miniport, so it has to follow the
somewhat confusing guidelines for HwS*AdapterControl. I think all of the
docs boil down to “don’t worry about the resources you mapped, you will get
called at HwS*FindAdapter if you need new ones”. The LSI sample might
confirm this.

Mark Roddy

On Wed, Apr 20, 2011 at 12:39 PM, wrote:

> Be aware, in addition, that VA to BAR mapping can and will change during
> PCI rebalancing events – the PnPDTest app in the WHQL test suite can test
> this functionality manually, but essentially (as Peter alluded to) once you
> get an MN_QUERY_STOP you should detach/ stop using those VA’s, once/if you
> get an Mx_STOP or SurpriseRemoval you should definitely stop using those
> VA’s until you get another Mx_START or Mx_STOP_CANCEL from PnP.
>
> This is important because in some boxes I’ve seen S0 to S4 transitions take
> the PCI bridge chips offline (power saving, bad design, bad kharma, lord
> knows), triggering just such a PCI rebalance/ renumeration …
>
> —
> 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
>

Thanks Peter, Mark and @choward.

The LSI sample also does the mapping only once as part of FindAdapter.

Girish.

“Girish Aithal” wrote in message news:xxxxx@ntdev…
> My storport based miniport driver requests for a mapping of the BAR to system virtual address space by invoking
> StorPortGetDeviceBase. Now, if the server is put to into hibernation and then resumed, is it safe to assume that the the virtual
> address mapped prior to hibernation is still valid after the resume. Or is it expected that the miniport requests for a re-map?
>
> From Windbg, I see that the virtual address mapping to BAR is maintained after resume, but wanted to be sure that this is
> guaranteed always.
>

> The LSI sample also does the mapping only once as part of FindAdapter.

I think FindAdapter will be called once more in MN_STOP_DEVICE+MN_START_DEVICE path.


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