Kernel Functions for Drivers pmtranscheck(9F)
NAME
pmtranscheck - Device power cycle advisory check
SYNOPSIS
#include
int pmtranscheck(struct pmtransdata *datap, timet *intervalp);
INTERFACE LEVEL
Solaris DI specific (Solaris DI)
PARAMETERS
datap Pointer to a pmtransdata structure
intervalp Pointer to time difference when next power
cycle will be advised
DESCRIPTION
The pmtranscheck() function checks if a power-cycle is
currently advised based on data in the pmtransdata struc-
ture. This function is provided to prevent damage to devices
from excess power cycles; drivers for devices that are sen-
sitive to the number of power cycles should call
pmtranscheck() from their power(9E) function before
powering-off a device. If pmtranscheck() indicates that
the device should not be power cycled, the driver should not
attempt to power cycle the device and should fail the call
to power(9E) entry point.
If pmtranscheck() returns that it is not advised to power
cycle the device, it attempts to calculate when the next
power cycle is advised, based on the supplied parameters. In
such case, intervalp returns the time difference (in
seconds) from the current time to when the next power cycle
is advised. If the time for the next power cycle cannot be
determined, intervalp indicates 0.
To avoid excessive calls to the power(9E) entry point during
a period when power cycling is not advised, the driver
should mark the corresponding device component busy for the
intervalp time period (if interval is not 0). Conveniently,
the driver can utilize the fact that calls to
pmbusycomponent(9F) are stacked. If power cycling is not
advised, the driver can call pmbusycomponent(9F) and
issue a timeout(9F) for the intervalp time. The timeout()
handler can issue the corresponding pmidlecomponent(9F)
call.
SunOS 5.11 Last change: 16 Oct 1999 1
Kernel Functions for Drivers pmtranscheck(9F)
When the format field of pmtransdata is set to
DCSCSIFORMAT, the caller must provide valid data in
svcdate[], lifemax, and ncycles. Currently, flag must be
set to 0.
struct pmscsicycles {
int lifemax; /* lifetime max power cycles */
int ncycles; /* number of cycles so far */
char svcdate[DCSCSIMFRLEN]; /* service date YW */
int flag; /* reserved for future */
};
struct pmtransdata {
int format; /* data format */
union {
struct pmscsicycles scsicycles;
} un;
};
RETURN VALUES
1 Power cycle is advised
0 Power cycle is not advised
-1 Error due to invalid argument.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
SEE ALSO
power.conf(4), attributes(5), power(9E)
Writing Device Drivers
Using Power Management
SunOS 5.11 Last change: 16 Oct 1999 2
|