Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pci_report_pmcap(9f) [opensolaris man page]

pci_report_pmcap(9F)					   Kernel Functions for Drivers 				      pci_report_pmcap(9F)

NAME
pci_report_pmcap - Report Power Management capability of a PCI device SYNOPSIS
#include <sys/ddi.h> #include <sys/sunddi.h> int pci_report_pmcap(dev_info_t *dip, int cap, void *arg); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI) PARAMETERS
dip Pointer to the device's dev_info structure cap Power management capability arg Argument for the capability DESCRIPTION
Some PCI devices provide power management capabilities in addition to those provided by the PCI Power Management Specification. The pci_report_pmcap() function reports those Power Management capabilities of the PCI device to the framework. Framework supports dynamic changing of the capability by allowing pci_report_pmcap() to be called multiple times. Following are the supported capabilities as indi- cated by the cap: PCI_PM_IDLESPEED -- The PCI_PM_IDLESPEED value indicates the lowest PCI clock speed that a device can tolerate when idle, and is applica- ble only to 33 MHz PCI bus. arg represents the lowest possible idle speed in KHz (1 KHz is 1000 Hz). The integer value representing the speed should be cast to (void *)before passing as arg to pci_report_pmcap(). The special values of arg are: PCI_PM_IDLESPEED_ANY The device can tolerate any idle clock speed. PCI_PM_IDLESPEED_NONE The device cannot tolerate slowing down of PCI clock even when idle. If the driver doesn't make this call, PCI_PM_IDLESPEED_NONE is assumed. In this case, one offending device can keep the entire bus from being power managed. RETURN VALUES
The pci_report_pmcap() function returns: DDI_SUCCESS Successful reporting of the capability DDI_FAILURE Failure to report capability because of invalid argument(s) CONTEXT
The pci_report_pmcap() function can be called from user, kernel and interrupt context. EXAMPLES
1. A device driver knows that the device it controls works with any clock between DC and 33 MHz as specified in Section 4.2.3.1: Clock Specification of the PCI Bus Specification Revision 2.1. The device driver makes the following call from its attach(9E): if (pci_report_pmcap(dip, PCI_PM_IDLESPEED, PCI_PM_IDLESPEED_ANY) != DDI_SUCCESS) cmn_err(CE_WARN, "%s%d: pci_report_pmcap failed ", ddi_driver_name(dip), ddi_get_instance(dip)); 2. A device driver controls a 10/100 Mb Ethernet device which runs the device state machine on the chip from the PCI clock. For the device state machine to receive packets at 100 Mb, the PCI clock cannot drop below 4 MHz. The driver makes the following call whenever it negoti- ates a 100 Mb Ethernet connection: if (pci_report_pmcap(dip, PCI_PM_IDLESPEED, (void *)4000) != DDI_SUCCESS) cmn_err(CE_WARN, "%s%d: pci_report_pmcap failed ", ddi_driver_name(dip), ddi_get_instance(dip)); ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ SEE ALSO
Writing Device Drivers PCI Bus Power Management Interface Specification Version 1.1 PCI Bus Specification Revision 2.1 SunOS 5.11 13 August 1999 pci_report_pmcap(9F)

Check Out this Related Man Page

pci_save_config_regs(9F)				   Kernel Functions for Drivers 				  pci_save_config_regs(9F)

NAME
pci_save_config_regs, pci_restore_config_regs - save and restore the PCI configuration registers SYNOPSIS
#include <sys/ddi.h> #include <sys/sunddi.h> int pci_save_config_regs(dev_info_t *dip); int pci_restore_config_regs(dev_info_t *dip); INTERFACE LEVEL
Solaris DDI-specific (Solaris DDI). ARGUMENTS
dip Pointer to the device's dev_info structure. DESCRIPTION
pci_save_config_regs() saves the current configuration registers on persistent system memory. pci_restore_config_regs() restores configura- tion registers previously saved by pci_save_config_regs(). pci_save_config_regs() should be called by the driver's power() entry point before powering a device off (to PCI state D3). Likewise, pci_restore_config_regs() should be called after powering a device on (from PCI state D3), but before accessing the device. See power(9E). RETURN VALUES
pci_save_config_regs() and pci_restore_config_regs() return: DDI_SUCCESS Operation completed successfully. DDI_FAILURE Operation failed to complete successfully. CONTEXT
Both these functions can be called from user or kernel context. EXAMPLES
Example 1 Invoking the save and restore functions static int xx_power(dev_info_t *dip, int component, int level) { struct xx *xx; int rval = DDI_SUCCESS; xx = ddi_get_soft_state(xx_softstate, ddi_get_instance(dip)); if (xx == NULL) { return (DDI_FAILURE); } mutex_enter(&xx->x_mutex); switch (level) { case PM_LEVEL_D0: XX_POWER_ON(xx); if (pci_restore_config_regs(dip) == DDI_FAILURE) { /* * appropriate error path handling here */ ... rval = DDI_FAILURE; } break; case PM_LEVEL_D3: if (pci_save_config_regs(dip) == DDI_FAILURE) { /* * appropriate error path handling here */ ... rval = DDI_FAILURE; } else { XX_POWER_OFF(xx); } break; default: rval = DDI_FAILURE; break; } mutex_exit(&xx->x_mutex); return (rval); } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE 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 02 June 2000 pci_save_config_regs(9F)
Man Page

Featured Tech Videos