2 .\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DDI_REMOVING_POWER 9F "Mar 14, 2001"
8 ddi_removing_power \- check whether \fBDDI_SUSPEND\fR might result in power
9 being removed from a device
14 #include <sys/sunddi.h>
18 \fBint\fR \fBddi_removing_power\fR(\fBdev_info_t\fR \fI*dip\fR);
24 Solaris DDI specific (Solaris DDI)
28 The \fBddi_removing_power()\fR function indicates whether a currently pending
29 call into a driver's \fBdetach\fR(9E) entry point with a command of
30 \fBDDI_SUSPEND\fR is likely to result in power being removed from the device.
33 \fBddi_removing_power()\fR can return true and power still not be removed from
34 the device due to a failure to suspend and power off the system.
38 The \fBddi_removing_power()\fR function supports the following parameter:
45 pointer to the device's \fBdev_info\fR structure
51 The \fBddi_removing_power()\fR function returns:
58 Power might be removed by the framework as a result of the pending
59 \fBDDI_SUSPEND\fR call.
68 Power will not be removed by the framework as a result of the pending
69 \fBDDI_SUSPEND\fR call.
74 \fBExample 1 \fRProtecting a Tape from Abrupt Power Removal
77 A tape driver that has hardware that would damage the tape if power is removed
78 might include this code in its \fBdetach\fR(9E) code:
84 xxdetach(dev_info_t *dip, ddi_detach_cmd_t cmd)
90 * We do not allow DDI_SUSPEND if power will be removed and
91 * we have a device that damages tape when power is removed
92 * We do support DDI_SUSPEND for Device Reconfiguration,
95 if (ddi_removing_power(dip) && xxdamages_tape(dip))
104 See \fBattributes\fR(5) for descriptions of the following attributes:
112 ATTRIBUTE TYPE ATTRIBUTE VALUE
114 Interface Stability Committed
120 \fBattributes\fR(5), \fBcpr\fR(7), \fBattach\fR(9E), \fBdetach\fR(9E)
123 \fIWriting Device Drivers\fR