8 #include <linux/kernel.h>
47 dev_dbg(&dev->
dev,
"Found capability 0x%x at 0x%x\n",
50 err = xen_pcibk_config_add_fields_offset(dev,
55 err = xen_pcibk_config_add_fields_offset(dev,
74 return pci_write_config_word(dev, offset, value);
82 .u.w.write = vpd_address_write,
93 static int pm_caps_read(
struct pci_dev *dev,
int offset,
u16 *value,
99 err = pci_read_config_word(dev, offset, &real_value);
111 #define PM_OK_BITS (PCI_PM_CTRL_PME_STATUS|PCI_PM_CTRL_DATA_SEL_MASK)
113 static int pm_ctrl_write(
struct pci_dev *dev,
int offset,
u16 new_value,
120 err = pci_read_config_word(dev, offset, &old_value);
125 new_state = (
pci_power_t)(new_value & PCI_PM_CTRL_STATE_MASK);
129 new_value = (old_value & ~PM_OK_BITS) | new_value;
130 err = pci_write_config_word(dev, offset, new_value);
136 dev_dbg(&dev->
dev,
"set power state to %x\n", new_state);
148 static void *pm_ctrl_init(
struct pci_dev *dev,
int offset)
153 err = pci_read_config_word(dev, offset, &value);
158 value &= ~PCI_PM_CTRL_PME_ENABLE;
159 err = pci_write_config_word(dev, offset, value);
170 .u.w.read = pm_caps_read,
175 .init = pm_ctrl_init,
177 .u.w.write = pm_ctrl_write,
194 .fields = caplist_pm,
198 .fields = caplist_vpd,
203 register_capability(&xen_pcibk_config_capability_vpd);
204 register_capability(&xen_pcibk_config_capability_pm);