diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2024-03-12 12:14:19 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2024-03-12 12:14:19 -0500 |
commit | 5aff0f394b83ee7dd3ee0dd01c5d256d651fffcd (patch) | |
tree | 3d342f91cf393d97129b8a66f41a009ae9f46f46 /drivers/pci/pci.c | |
parent | 6613476e225e090cc9aad49be7fa504e290dd33d (diff) | |
parent | 0a5a46a6a61be7b63c12c18495d427f91f3662a9 (diff) |
Merge branch 'pci/aer'
- Fix sysfs paths in aer_rootport_total_err_* documentation (Johan Hovold)
- Block runtime suspend while handling AER errors (Stanislaw Gruszka)
- Add a generic Header Log structure and reader shared by AER and DPC (Ilpo
Järvinen)
* pci/aer:
PCI/AER: Generalize TLP Header Log reading
PCI/AER: Use explicit register size for PCI_ERR_CAP
PCI/AER: Block runtime suspend when handling errors
PCI/AER: Clean up version indentation in ABI docs
PCI/AER: Fix rootport attribute paths in ABI docs
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d8f11a078924c..a0af94cfcf7dc 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1068,6 +1068,34 @@ disable_acs_redir: } /** + * pcie_read_tlp_log - read TLP Header Log + * @dev: PCIe device + * @where: PCI Config offset of TLP Header Log + * @tlp_log: TLP Log structure to fill + * + * Fill @tlp_log from TLP Header Log registers, e.g., AER or DPC. + * + * Return: 0 on success and filled TLP Log structure, <0 on error. + */ +int pcie_read_tlp_log(struct pci_dev *dev, int where, + struct pcie_tlp_log *tlp_log) +{ + int i, ret; + + memset(tlp_log, 0, sizeof(*tlp_log)); + + for (i = 0; i < 4; i++) { + ret = pci_read_config_dword(dev, where + i * 4, + &tlp_log->dw[i]); + if (ret) + return pcibios_err_to_errno(ret); + } + + return 0; +} +EXPORT_SYMBOL_GPL(pcie_read_tlp_log); + +/** * pci_restore_bars - restore a device's BAR values (e.g. after wake-up) * @dev: PCI device to have its BARs restored * |