Subject: Re: pmf(9): shutdown & D1/D2 states
To: None <tech-kern@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-kern
Date: 12/23/2007 23:19:10
On Sun, Dec 23, 2007 at 03:10:14PM -0600, David Young wrote:
> Shutdown and suspend are not the same state, and we can avoid some work
> at shutdown time if we skip a full suspend on most devices, so I propose
> to let devices supply an optional third PM callback:

I don't think this is a good idea as making a device quiet is a
precondition for save reboot as it is necesary to stop DMA etc. Making
it a second hook just makes it much easier to not implement it and we are
back at what we have been before. The only case where we really wanted
to distinguish so far are the hard disks. I would take vga as exception
as ddb(4) should/needs to taught to deal with resetting it anyway and
therefore vga and other console devices should power themselve up again
on panic.

> According to my understanding of D1 state (Jared McNeill filled me in),
> it is a power-reduced state where the device state is not lost.  A device
> may reduce its capacities in D1 state, but it is still operational.

Yes and no. The problem is that for example the PCI spec says that a
device in Dx for x>0 is not allowed to create bus cycles. The only way
it can get the attention of the system is by asserting a special pin. We
don't have support for power intterupts at the same.

Similiar for D2.

A single call back is not enough as you need to handle wake-up
differently and depending on the hardware you need to do more than just
set D0 state.

The definition of D1 and D2 is more useful than what I heard so far :)
I am stressing that point because it is important to have a consistent
definition for a system to make intelligent decisions. E.g. with above
the kernel can under the control of some policy always put a device into
D1 state, but it can't put it into D2 if it has to remain operational.

> * Device Properties 

Agreed with this.

Joerg