mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 15:22:21 -04:00
PCI/AER: Move retrieval of FEP and TLP Log into helper
When aer_get_device_error_info() gathers information on Uncorrectable Errors from a device, it reads the First Error Pointer and TLP Prefix/ Header Log and caches them in struct aer_err_info. Those two fields will also need to be read for Advisory Non-Fatal Errors (which are signaled as Correctable Errors). Move their retrieval into a new aer_get_uncor_info() helper for reuse by the imminent Advisory Non-Fatal Error support. No functional change intended. Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/0f2f037c7ccf099f0c253cbc4ad9be526c68c5af.1784905909.git.lukas@wunner.de
This commit is contained in:
committed by
Bjorn Helgaas
parent
a8bf2dd750
commit
f141f74c45
@@ -1289,6 +1289,27 @@ void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
|
||||
EXPORT_SYMBOL_GPL(aer_recover_queue);
|
||||
#endif
|
||||
|
||||
static void aer_get_uncor_info(struct pci_dev *dev, struct aer_err_info *info,
|
||||
u32 status)
|
||||
{
|
||||
u16 aer = dev->aer_cap;
|
||||
u32 aercc;
|
||||
|
||||
/* Get First Error Pointer */
|
||||
pci_read_config_dword(dev, aer + PCI_ERR_CAP, &aercc);
|
||||
info->first_error = PCI_ERR_CAP_FEP(aercc);
|
||||
|
||||
/* Get TLP Prefix/Header Log */
|
||||
if (tlp_header_logged(status, aercc)) {
|
||||
info->tlp_header_valid = 1;
|
||||
pcie_read_tlp_log(dev, aer + PCI_ERR_HEADER_LOG,
|
||||
aer + PCI_ERR_PREFIX_LOG,
|
||||
aer_tlp_log_len(dev, aercc),
|
||||
aercc & PCI_ERR_CAP_TLP_LOG_FLIT,
|
||||
&info->tlp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* aer_get_device_error_info - read error status from dev and store it to info
|
||||
* @info: pointer to structure to store the error record
|
||||
@@ -1302,7 +1323,6 @@ int aer_get_device_error_info(struct aer_err_info *info, int i)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
int type, aer;
|
||||
u32 aercc;
|
||||
|
||||
if (i >= AER_MAX_MULTI_ERR_DEVICES)
|
||||
return 0;
|
||||
@@ -1340,18 +1360,7 @@ int aer_get_device_error_info(struct aer_err_info *info, int i)
|
||||
if (!(info->status & ~info->mask))
|
||||
return 0;
|
||||
|
||||
/* Get First Error Pointer */
|
||||
pci_read_config_dword(dev, aer + PCI_ERR_CAP, &aercc);
|
||||
info->first_error = PCI_ERR_CAP_FEP(aercc);
|
||||
|
||||
if (tlp_header_logged(info->status & ~info->mask, aercc)) {
|
||||
info->tlp_header_valid = 1;
|
||||
pcie_read_tlp_log(dev, aer + PCI_ERR_HEADER_LOG,
|
||||
aer + PCI_ERR_PREFIX_LOG,
|
||||
aer_tlp_log_len(dev, aercc),
|
||||
aercc & PCI_ERR_CAP_TLP_LOG_FLIT,
|
||||
&info->tlp);
|
||||
}
|
||||
aer_get_uncor_info(dev, info, info->status & ~info->mask);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user