Kernel Functions for Drivers pcisaveconfigregs(9F)
NAME
pcisaveconfigregs, pcirestoreconfigregs - save and
restore the PCI configuration registers
SYNOPSIS
#include
#include
int pcisaveconfigregs(devinfot *dip);
int pcirestoreconfigregs(devinfot *dip);
INTERFACE LEVEL
Solaris DI-specific (Solaris DI).
ARGUMENTS
dip Pointer to the device's devinfo structure.
DESCRIPTION
pcisaveconfigregs() saves the current configuration
registers on persistent system memory.
pcirestoreconfigregs() restores configuration registers
previously saved by pcisaveconfigregs().
pcisaveconfigregs() should be called by the driver's
power() entry point before powering a device off (to PCI
state D3). Likewise, pcirestoreconfigregs() should be
called after powering a device on (from PCI state D3), but
before accessing the device. See power(9E).
RETURN VALUES
pcisaveconfigregs() and pcirestoreconfigregs() return:
DISUCES Operation completed successfully.
DIFAILURE Operation failed to complete successfully.
CONTEXT
Both these functions can be called from user or kernel con-
text.
EXAMPLES
Example 1 Invoking the save and restore functions
SunOS 5.11 Last change: 02 June 2000 1
Kernel Functions for Drivers pcisaveconfigregs(9F)
static int
xxpower(devinfot *dip, int component, int level) {
struct xx *xx;
int rval = DISUCES;
xx = ddigetsoftstate(xxsoftstate, ddigetinstance(dip));
if (xx == NUL) {
return (DIFAILURE);
}
mutexenter(&xx->xmutex);
switch (level) {
case PMLEVELD0:
XPOWERON(xx);
if (pcirestoreconfigregs(dip) == DIFAILURE) {
/*
* appropriate error path handling here
*/
...
rval = DIFAILURE;
}
break;
case PMLEVELD3:
if (pcisaveconfigregs(dip) == DIFAILURE) {
/*
* appropriate error path handling here
*/
...
rval = DIFAILURE;
}
else {
XPOWEROF(xx);
}
break;
default:
rval = DIFAILURE;
break;
}
mutexexit(&xx->xmutex);
return (rval);
}
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 02 June 2000 2
Kernel Functions for Drivers pcisaveconfigregs(9F)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
SEE ALSO
attributes(5), power(9E)
Writing Device Drivers
PCI Bus Power Management Interface Specification Version 1.1
PCI Bus Specification Revision 2.1
SunOS 5.11 Last change: 02 June 2000 3
|