Bug #1132

Power off for PCI devices

Added by hasso almost 10 years ago. Updated almost 10 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


With this tiny patch power is turned off for PCI devices during detach
(ie. when you unload module). It makes is possible to preserve power in
laptops (and make them cooler) with unloading network and/or sound device
modules not in use and load them only if really needed.

However, I'm really not sure about all consequences this patch might
cause, might knowledge about newbus and friends are still quite limited.
Any objections to commit this?

Tested with em(4), ath(4) and snd_hda(4).


#1 Updated by hasso almost 10 years ago


#2 Updated by Johannes.Hofmann almost 10 years ago

Nice! Do the modules have to be loaded (and then unloaded) for this to
take effect or is it enough to just not load them in the first place?


#3 Updated by hasso almost 10 years ago

It was enough to just not load them even before this patch. Powering down
not used devices at boot time was already there with this commit:

This patch adds just the ability to power down a devices on module unload.

#4 Updated by Johannes.Hofmann almost 10 years ago

Ah ok. Is there a way to verify the state of the pci devices?
On my T42 thinkpad I don't see any difference in power consumption
with hw.pci.do_power_nodriver=1 (measured with an external device and
battery removed). I'm always around 20 Watt, with est enabled,
"DynamicClocks" "on" in xorg.conf, and screen backlight set to the
lowest possible value.


#5 Updated by hasso almost 10 years ago

I use hw.pci.do_power_nodriver=3, btw, but it shouldn't matter much. Is
there unused devices at all? And these devices have to have power
management capabilities, not all PCI devices have these.

I use sysutils/pciutils from pkgsrc to play with PCI configuration space.
It doesn't compile in DragonFly without the patch, pkgsrc bugreport is
there about year or so :(. Take patch is available at [1]. lspci -vvv
shows to you all devices with decoded configuration space. For example
ABOUT my wireless card it shows this:

Capabilities: [40] Power Management version 2
Flags: PMEClk- DSI- D1+ D2- AuxCurrent=375mA
Status: D3 PME-Enable- DSel=0 DScale=0 PME-

Important bit is "Status: D3" - ie. this device is powered down.

[1] -

#6 Updated by Johannes.Hofmann almost 10 years ago

lspci -vv indeed shows some devices (usb controller, sound card, ethernet card,
and modem) in D3 state.


Also available in: Atom PDF