The DDI_SUSPEND cmd is issued when the entire system is being suspended and power removed from it or when the system must be made quiescent. It will be issued only to devices which have a reg property or which export
a pm-hardware-state property with the value needs-suspend-resume.
If cmd is set to DDI_SUSPEND, detach() is used to suspend all activity of a device before power is (possibly) removed from the device. The steps associated with suspension must include putting the underlying device into a quiescent state
so that it will not generate interrupts or modify or access memory. Once quiescence has been obtained, detach() can be called with outstanding open(9E) requests.
It must save the hardware state of the device to memory and block incoming or existing requests until attach() is called with DDI_RESUME.
If the device is used to store file systems, then after DDI_SUSPEND is issued, the device should still honor dump(9E) requests as this entry point
may be used by suspend-resume operation (see cpr(7)) to save state file. It must do this, however, without disturbing the saved hardware state of the device.
If the device driver uses original Power Management interfaces (driver calls pm_create_components(9F)) and it has also been suspended by DDI_PM_SUSPEND, it will need to call ddi_dev_is_needed(9F) to honor the dump(9E) request. If the device driver uses new automatic device Power Management interfaces (driver exports pm-components(9P)
property instead of calling pm_create_components(9F), it might need to call pm_raise_power(9F) if the current power level is lower than required to complete the dump(9E) request.
Before returning successfully from a call to detach() with a command of DDI_SUSPEND, the driver must cancel any outstanding timeouts and make any driver threads quiescent.
If DDI_FAILURE is returned for the DDI_SUSPEND cmd, either the operation to suspend the system or to make it quiescent will be aborted.
|