DEVICE_CAPABILITIES values for Ethernet device

I am developing a miniport driver for an Ethernet device for which the power management capabilities (output of !ndiskd.miniport -pm command) are shown as

kd> !ndiskd.miniport 899510e0 -pm

POWER MANAGEMENT

Bus Capabilities (IRP_MN_QUERY_CAPABILITIES):
SystemWake PowerSystemWorking
SystemWake D0

System State Device State _
Unspecified PowerDeviceUnspecified
Working D0
S1 PowerDeviceUnspecified
S2 PowerDeviceUnspecified
S3 D3
S4 (Hibernate) D3
S5 (Shutdown) D3

Device sleep is supported when the system is fully powered on

Cached DEVICE_CAPABILITIES structure 899513a0

Device Capabilities (OID_PM_HARDWARE_CAPABILITIES):
WoL Patterns 00000002 ? WOL_MAGIC_PACKET
Protocol Offloads [No flags set]
Num Patterns 1

Wake Event Minimum Power Required _
Magic Packet D3
Bitmap Pattern Not supported
Link Change Not supported

Current Capabilities (OID_PM_CURRENT_CAPABILITIES):
WoL Patterns [No flags set]
Protocol Offloads [No flags set]
Num Patterns 1

Wake Event Minimum Power Required _
Magic Packet Not supported
Bitmap Pattern Not supported
Link Change Not supported

Active Capabilities (OID_PM_PARAMETERS):
WoL Patterns [No flags set]
Protocol Offloads [No flags set]
Wake Flags [No flags set]

? Active WoL patterns
? Active protocol offloads
0: kd> dt _DEVICE_CAPABILITIES 899513a0
ks!_DEVICE_CAPABILITIES
+0x000 Size : 0x40
+0x002 Version : 1
+0x004 DeviceD1 : 0y0
+0x004 DeviceD2 : 0y0
+0x004 LockSupported : 0y0
+0x004 EjectSupported : 0y0
+0x004 Removable : 0y0
+0x004 DockDevice : 0y0
+0x004 UniqueID : 0y0
+0x004 SilentInstall : 0y0
+0x004 RawDeviceOK : 0y0
+0x004 SurpriseRemovalOK : 0y0
+0x004 WakeFromD0 : 0y1
+0x004 WakeFromD1 : 0y0
+0x004 WakeFromD2 : 0y0
+0x004 WakeFromD3 : 0y0
+0x004 HardwareDisabled : 0y0
+0x004 NonDynamic : 0y0
+0x004 WarmEjectSupported : 0y0
+0x004 NoDisplayInUI : 0y0
+0x004 Reserved1 : 0y0
+0x004 Reserved : 0y0000000000000 (0)
+0x008 Address : 0
+0x00c UINumber : 9
+0x010 DeviceState : [7] 0 ( PowerDeviceUnspecified )
+0x02c SystemWake : 1 ( PowerSystemWorking )
+0x030 DeviceWake : 1 ( PowerDeviceD0 )
+0x034 D1Latency : 0
+0x038 D2Latency : 2
+0x03c D3Latency : 0x64

I don’t understand why SystemWake of Bus Capabilities is set to PowerSystemWorking ?

How can we wake the system when it is fully powered on? Can it be changed to lower power states?

Thanks in Advance.

Sathish

What bus enumerates your miniport? PCI, USB, …? These values are largely provided by the bus driver.

Jeffrey,

PCI bus enumerates my miniport.

I know that ACPI driver sets some of the fields of DEVICE_CAPABILITIES, such as SystemWake at the time of system enumeration. Then bus driver sets DeviceWake by reading device power management capabilities.Also bus driver consider System State to Device State mapping while setting DeviceWake.

But what confuses me here is, SystemWake field is set to PowerSystemWorking and DeviceState is set to PowerDeviceD0. What’s the use of a wake event when the system is running.

Additional Details of the device power management capabilities register.

For the device, only PME is enable only for D3 Hot state but not for D3 cold state and no auxiliary power is supplied.

Thanks,
Sathish

I’m not sure myself - the PCI logic is quite complex, since it depends on ACPI and a large amount of compatibility code in the PCI bus driver. Maybe somebody else would know?

A couple of years ago, I decided that I should track down all the entries in DEVICE_CAPABILITIES and explain where they come from, at least for PCI and/or ACPI devices. (USB is still somewhat mysterious to me, as I’ve never written a full driver for a USB device.) At the time I was trying to help one of the ARM vendors bring up their chip running Windows RT and they were highly confused in this area. My plan was to put the result on Doron’s blog.

The problem was that, as I started collecting the material for the topic, I realized that it was so vastly complex that there wasn’t an easy way to explain it. The topic you’re interested in came down to statements like this:

“If the OS, which is to say the ACPI driver in conjunction with the bus driver, can’t convince themselves that the wake signals will actually be delivered, then it will set SystemWake to PowerSystemWorking and DeviceWake to PowerDeviceD0 to indicate that the device shouldn’t even be expected to trigger a wake signal. If the miniport reports that it supports wake signals, NDIS will send IRP_MN_WAIT_WAKE through the stack and arm the device for wake when the miniport is started. (And even that is truly historical behavior, not what we’d do if we were starting fresh in this area.)”

Of course, that just begs the question “what does it take to convince the ACPI and PCI drivers that wake signals will be delivered?” That’s where it became impossible to contain this in a blog post. To properly cover the topic, I’d have to write a book about ACPI and the way it interacts with Windows, and that book would be a huge time suck and a commercial failure.

There are about five different ways within ACPI (which is a fully general language, probably Turing Complete) to express the concept of wake signals. Sometimes they come through “General Purpose Event” pins, which are enumerated through the _GPE part of the namespace. Sometimes they come through an “Embedded Controller” and are surfaced more or less as device interrupts which then reflect back into ACPI through the control methods under the embedded controller device, surfaced as a “Notify” statement (and sometimes BIOS guys get the “Notify (devicepath, 2)” statement wrong and use a “Notify (devicepath, 1)” so there’s special case code in the OS to try to figure that out and deal with it. Sometimes they arrive as GPIO interrupts, described as a secondary interrupt resource on the devices that might trigger the signal. Sometimes they come in through a third party driver for completely custom logic on the board which then invokes a control method which then does the “Notify”.

All of this is modulated by a lot of other objects in the ACPI namespace. Some of those say things like “wake will be enabled when this power rail is turned on, and you should look for the list of devices which will depend on this power rail.” Others say things like “the wake signal can only be triggered through these S-states, and these D-states,” and there are an oddly large number of variations on the way that this is expressed.

There’s more to the ACPI topic, but I’m going to stop here.

All of this is bent around the bus driver, too. For instance, the PCI bus driver has two very distinct modes, one where the BIOS keeps control of PCI Express and one where it gives that over to the OS. When it gives that over to the OS, we can be certain that wake signals will actually work when the machine is in S0, and so that is reflected in DEVICE_CAPABILITIES. When it keeps it, there really isn’t a machine in the world where the wake signals work in S0, so we leave that as DevicePowerD0.

So the short answer to your question, Sathish, is that your problem is with your BIOS or your motherboard. Either the motherboard itself wasn’t designed to actually deliver wake signals and the BIOS is properly reflecting that to the OS, or the BIOS vendor and/or OEM decided not to expose this feature of the motherboard because they didn’t feel like testing it or they didn’t feel that the market required it, or the BIOS is simply busted.

Try a different machine. For these purposes, I suggest that you contact Intel and get a “Software Development Platform” or “SDP” machine from them. These are machines where every possible configuration and option is exposed and you get to turn each on and off separately, using a single machine to test lots of situations. We work with them to ensure that the BIOSes in these machines more or less work. Other machines tend to have these features turned off, either intentionally or accidentally.

  • Jake Oshins
    (former ACPI guy)
    Windows Kernel Team

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Jeffrey Tippet
Sent: Thursday, May 23, 2013 8:22 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] DEVICE_CAPABILITIES values for Ethernet device

I’m not sure myself - the PCI logic is quite complex, since it depends on ACPI and a large amount of compatibility code in the PCI bus driver. Maybe somebody else would know?


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

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

Thank you very much Jake for the valuable information.

My problem got solved. Now able to get the DEVICE_CAPABILITIES with DeviceWake field set to DevicePowerD3.

Previoulsy the device supports the wake from D3 hot state only but not D3 cold state.

Now H/W guys changed the hardware capabilities to support the wake from D3 cold state. That resolves the issue.

I think System State to device state mapping doesn’t have D3 hot state. So even the hardware exposed that the device has the capability to wake from D3 hot state, OS ignored that and returned the DeviceWake as DevicePowerD0.

Thank You All for your support.

That would occur when the underlying BIOS said that it can’t maintain Vaux in any D-state other than D0. (Or, more specifically, failed to say that it could maintain Vaux.)

  • Jake

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Friday, May 31, 2013 2:46 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] DEVICE_CAPABILITIES values for Ethernet device

Thank you very much Jake for the valuable information.

My problem got solved. Now able to get the DEVICE_CAPABILITIES with DeviceWake field set to DevicePowerD3.

Previoulsy the device supports the wake from D3 hot state only but not D3 cold state.

Now H/W guys changed the hardware capabilities to support the wake from D3 cold state. That resolves the issue.

I think System State to device state mapping doesn’t have D3 hot state. So even the hardware exposed that the device has the capability to wake from D3 hot state, OS ignored that and returned the DeviceWake as DevicePowerD0.

Thank You All for your support.


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

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