enabling NDIS 6.20 Power management capabilities

Hi All,

I am trying to enable power management capabilities for my PCI card in Windows 7 but powermanagement tab doesnot show up, PM_SUPPORTED bit doesnt show up in pnp flags in !ndiskd.miniport, I dont get calls to the PM OIDS and PM cababilities dont show up in !ndiskd.miniport [addr] -pm

NT!DEVICE_CAPABILITIES says:
ntdll!_DEVICE_CAPABILITIES
+0x004 WakeFromD0 : 0y1
+0x004 WakeFromD1 : 0y0
+0x004 WakeFromD2 : 0y0
+0x004 WakeFromD3 : 0y1
+0x02c SystemWake : 5 ( PowerSystemHibernate )
+0x030 DeviceWake : 4 ( PowerDeviceD3 )
+0x034 D1Latency : 0
+0x038 D2Latency : 2
+0x03c D3Latency : 0x64

  1. I have set PowerManagementCapabilitiesEx in NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES with a pointer to NDIS_PM_CAPABILITIES filled with WOL & protocol offload capabilities.
  2. I have set NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES.PowerManagementCapabilities to NULL.
  3. OID_PM_PARAMETERS, OID_PM_ADD_WOL_PATTERN, OID_PM_REMOVE_WOL_PATTERN, OID_PM_ADD_PROTOCOL_OFFLOAD, OID_PM_REMOVE_PROTOCOL_OFFLOAD, OID_PM_GET_PROTOCOL_OFFLOAD are supported and handled.

Any help highly appreciated.

Thanks
Arun

Here’s a shot-in-the-dark: did you use the NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND flag in your NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES? That disables power management like this.

Can you post the full output of !ndiskd.miniport and !ndiskd.miniport -pm?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, October 27, 2010 3:41 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] enabling NDIS 6.20 Power management capabilities

Hi All,

I am trying to enable power management capabilities for my PCI card in Windows 7 but powermanagement tab doesnot show up, PM_SUPPORTED bit doesnt show up in pnp flags in !ndiskd.miniport, I dont get calls to the PM OIDS and PM cababilities dont show up in !ndiskd.miniport [addr] -pm

NT!DEVICE_CAPABILITIES says:
ntdll!_DEVICE_CAPABILITIES
+0x004 WakeFromD0 : 0y1
+0x004 WakeFromD1 : 0y0
+0x004 WakeFromD2 : 0y0
+0x004 WakeFromD3 : 0y1
+0x02c SystemWake : 5 ( PowerSystemHibernate )
+0x030 DeviceWake : 4 ( PowerDeviceD3 )
+0x034 D1Latency : 0
+0x038 D2Latency : 2
+0x03c D3Latency : 0x64

  1. I have set PowerManagementCapabilitiesEx in NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES with a pointer to NDIS_PM_CAPABILITIES filled with WOL & protocol offload capabilities.
  2. I have set NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES.PowerManagementCapabilities to NULL.
  3. OID_PM_PARAMETERS, OID_PM_ADD_WOL_PATTERN, OID_PM_REMOVE_WOL_PATTERN, OID_PM_ADD_PROTOCOL_OFFLOAD, OID_PM_REMOVE_PROTOCOL_OFFLOAD, OID_PM_GET_PROTOCOL_OFFLOAD are supported and handled.

Any help highly appreciated.

Thanks
Arun


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

Hi Jeffrey

Thanks for the help. Actually I figured what went wrong with help from ndis6fb. I missed changing the GENERAL_ATTRIBUTES_REVISION to 2 from 1. And PM tab started showing up, OIDs started coming etc.,

I do set NO_HALT_ON_SUSPEND in my registration attributes, it is set because I dont depend on the adapter to hold any states during suspend. May be that explains why WoLWin7Pattern ndistest is not running on the card? it is finding a WMI error:
“XXXXXXXXXXXX XXXX Adapter #1 does not support GUID_POWER_DEVICE_ENABLE wmirequest:Failed while calling WmiRequest on Adapter”.

Thanks
Arun

> Actually I figured what went wrong with help from ndis6fb

So I saw :wink:

May be that explains why WoLWin7Pattern ndistest is not running on the card?

GUID_POWER_DEVICE_ENABLE is indeed disabled for miniports that set the flag. I would try building your miniport without that flag. (Verification step: !ndiskd.miniport will show “NO_HALT_ON_SUSPEND” under PnPFlags).

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Friday, October 29, 2010 6:12 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] enabling NDIS 6.20 Power management capabilities

Hi Jeffrey

Thanks for the help. Actually I figured what went wrong with help from ndis6fb. I missed changing the GENERAL_ATTRIBUTES_REVISION to 2 from 1. And PM tab started showing up, OIDs started coming etc.,

I do set NO_HALT_ON_SUSPEND in my registration attributes, it is set because I dont depend on the adapter to hold any states during suspend. May be that explains why WoLWin7Pattern ndistest is not running on the card? it is finding a WMI error:
“XXXXXXXXXXXX XXXX Adapter #1 does not support GUID_POWER_DEVICE_ENABLE wmirequest:Failed while calling WmiRequest on Adapter”.

Thanks
Arun


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

Hi Jeffrey

One thing I am not able to understand is why setting NO_HALT_ON_SUSPEND will disable GUID_POWER_DEVICE_ENABLE.

Thanks
Arun

It disables GUID_POWER_DEVICE_ENABLE because there’s a stanza of code in the implementation of NDIS.SYS that says:

if (Guid is GUID_POWER_DEVICE_ENABLE) {
if (Miniport has flag NO_HALT_ON_SUSPEND) {
NtStatus = STATUS_INVALID_DEVICE_REQUEST;
} else {
// Implement change of configuration.
}
}

Yeah, but why is NDIS implemented that way? Well, as is typical for NDIS, you have to peer back into history, somewhat…

The NDIS6.x flag NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND basically continues the heritage of the NDIS5.x flag NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND. The NDIS5.x flag was added for miniports that can’t really do power management. (IM drivers and very old hardware miniports).

When NDIS gained power-management support, we had to do something with the existing universe of miniports that don’t support power management at all. The solution is to just halt the miniport when the system goes to sleep, then start the miniport again after the system resumes. This is klunky, but it is as good as you can get without changes in the miniport.

If you have a newer miniport driver (say NDIS 5.1) but old hardware that doesn’t support power management, then you can tell NDIS “You don’t have to halt me – I can cope with the fact that my hardware will lose its brains during this power transition. I promise to save off and restore its state for you (instead of having you restart me and replay all the OIDs for packet filters).” That’s why the flag was created.

Now we needed to know if the UI could show some power-management checkboxes for a given piece of hardware. We decided that if the miniport begs for “legacy” treatment, (i.e., it invokes the NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND flag), that’s a good indicator that the miniport can’t really handle power management. So that flag disables the checkboxes.

If you’re writing a modern miniport for modern hardware, there’s really no need for the flag (unless you’re a virtual miniport, i.e., an IM driver). Just support power management. Then your miniport won’t be halted AND you have all the benefits of proper PM support.

BTW, MSDN has some discussion on the flag here: http://msdn.microsoft.com/en-us/library/ff570196(VS.85).aspx . As you’re reading that, keep in mind that the article was mostly written during NDIS 5.1 times, so what it terms “old miniports” really means OLD miniports by today’s standards.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, November 03, 2010 6:18 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] enabling NDIS 6.20 Power management capabilities

Hi Jeffrey

One thing I am not able to understand is why setting NO_HALT_ON_SUSPEND will disable GUID_POWER_DEVICE_ENABLE.

Thanks
Arun


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

>miniports that don’t support power management at all. The solution is to just halt the miniport when

the system goes to sleep, then start the miniport again after the system resumes. This is klunky

Oh yes.

TCP/IP in some Windows versions was the same - no power management lower edge PnP handlers, thus unbind and rebind of all miniports on each power cycle.

Don’t remember what WinNT it was (w2k?), but I remember for sure it was so in WinCE 4.2, which was rather popular OS once for HP iPaqs and similar devices.


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