@@ -34,7 +34,7 @@ void pci_disable_ptm(struct pci_dev *dev)
int ptm;
u16 ctrl;
- if (!pci_is_pcie(dev))
+ if (!dev->ptm_enabled)
return;
ptm = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM);
@@ -44,6 +44,7 @@ void pci_disable_ptm(struct pci_dev *dev)
pci_read_config_word(dev, ptm + PCI_PTM_CTRL, &ctrl);
ctrl &= ~(PCI_PTM_CTRL_ENABLE | PCI_PTM_CTRL_ROOT);
pci_write_config_word(dev, ptm + PCI_PTM_CTRL, ctrl);
+ dev->ptm_enabled = 0;
}
void pci_save_ptm_state(struct pci_dev *dev)
@@ -83,6 +84,7 @@ void pci_restore_ptm_state(struct pci_dev *dev)
cap = (u16 *)&save_state->cap.data[0];
pci_write_config_word(dev, ptm + PCI_PTM_CTRL, *cap);
+ dev->ptm_enabled = !!(*cap & PCI_PTM_CTRL_ENABLE);
}
void pci_ptm_init(struct pci_dev *dev)