1pci_save_config_regs(9F) Kernel Functions for Drivers pci_save_config_regs(9F)
2
3
4

NAME

6       pci_save_config_regs,  pci_restore_config_regs  -  save and restore the
7       PCI configuration registers
8

SYNOPSIS

10       #include <sys/ddi.h>
11       #include <sys/sunddi.h>
12
13
14
15       int pci_save_config_regs(dev_info_t *dip);
16
17
18       int pci_restore_config_regs(dev_info_t *dip);
19
20

INTERFACE LEVEL

22       Solaris DDI-specific (Solaris DDI).
23

ARGUMENTS

25       dip    Pointer to the device's dev_info structure.
26
27

DESCRIPTION

29       pci_save_config_regs() saves the  current  configuration  registers  on
30       persistent system memory. pci_restore_config_regs() restores configura‐
31       tion registers previously saved by pci_save_config_regs().
32
33
34       pci_save_config_regs() should be called by the driver's  power()  entry
35       point  before  powering  a  device  off  (to  PCI  state D3). Likewise,
36       pci_restore_config_regs() should be called after powering a  device  on
37       (from PCI state D3), but before accessing the device. See power(9E).
38

RETURN VALUES

40       pci_save_config_regs() and pci_restore_config_regs() return:
41
42       DDI_SUCCESS    Operation completed successfully.
43
44
45       DDI_FAILURE    Operation failed to complete successfully.
46
47

CONTEXT

49       Both these functions can be called from user or kernel context.
50

EXAMPLES

52       Example 1 Invoking the save and restore functions
53
54         static int
55         xx_power(dev_info_t *dip, int component, int level) {
56            struct xx *xx;
57            int rval = DDI_SUCCESS;
58
59            xx = ddi_get_soft_state(xx_softstate, ddi_get_instance(dip));
60            if (xx == NULL) {
61                return (DDI_FAILURE);
62            }
63
64            mutex_enter(&xx−>x_mutex);
65
66            switch (level) {
67            case PM_LEVEL_D0:
68                XX_POWER_ON(xx);
69                if (pci_restore_config_regs(dip) == DDI_FAILURE) {
70                    /*
71                     * appropriate error path handling here
72                     */
73                    ...
74                    rval = DDI_FAILURE;
75                    }
76                break;
77
78            case PM_LEVEL_D3:
79                if (pci_save_config_regs(dip) == DDI_FAILURE) {
80                     /*
81                      * appropriate error path handling here
82                      */
83                     ...
84                     rval = DDI_FAILURE;
85                     }
86                 else {
87                     XX_POWER_OFF(xx);
88                 }
89                 break;
90
91             default:
92                   rval = DDI_FAILURE;
93                   break;
94             }
95
96             mutex_exit(&xx−>x_mutex);
97             return (rval);
98         }
99
100

ATTRIBUTES

102       See attributes(5) for descriptions of the following attributes:
103
104
105
106
107       ┌─────────────────────────────┬─────────────────────────────┐
108       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
109       ├─────────────────────────────┼─────────────────────────────┤
110       │Interface Stability          │Committed                    │
111       └─────────────────────────────┴─────────────────────────────┘
112

SEE ALSO

114       attributes(5), power(9E)
115
116
117       Writing Device Drivers
118
119
120       PCI Bus Power Management Interface Specification Version 1.1
121
122
123       PCI Bus Specification Revision 2.1
124
125
126
127SunOS 5.11                       02 June 2000         pci_save_config_regs(9F)
Impressum