diff options
| -rw-r--r-- | drivers/pci/pcie/aer/aerdrv_acpi.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c index 4f798ab629c8..e7ea5735a61f 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c | |||
| @@ -29,6 +29,22 @@ static inline int hest_match_pci(struct acpi_hest_aer_common *p, | |||
| 29 | p->function == PCI_FUNC(pci->devfn)); | 29 | p->function == PCI_FUNC(pci->devfn)); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | static inline bool hest_match_type(struct acpi_hest_header *hest_hdr, | ||
| 33 | struct pci_dev *dev) | ||
| 34 | { | ||
| 35 | u16 hest_type = hest_hdr->type; | ||
| 36 | u8 pcie_type = pci_pcie_type(dev); | ||
| 37 | |||
| 38 | if ((hest_type == ACPI_HEST_TYPE_AER_ROOT_PORT && | ||
| 39 | pcie_type == PCI_EXP_TYPE_ROOT_PORT) || | ||
| 40 | (hest_type == ACPI_HEST_TYPE_AER_ENDPOINT && | ||
| 41 | pcie_type == PCI_EXP_TYPE_ENDPOINT) || | ||
| 42 | (hest_type == ACPI_HEST_TYPE_AER_BRIDGE && | ||
| 43 | (dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)) | ||
| 44 | return true; | ||
| 45 | return false; | ||
| 46 | } | ||
| 47 | |||
| 32 | struct aer_hest_parse_info { | 48 | struct aer_hest_parse_info { |
| 33 | struct pci_dev *pci_dev; | 49 | struct pci_dev *pci_dev; |
| 34 | int firmware_first; | 50 | int firmware_first; |
| @@ -38,28 +54,11 @@ static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data) | |||
| 38 | { | 54 | { |
| 39 | struct aer_hest_parse_info *info = data; | 55 | struct aer_hest_parse_info *info = data; |
| 40 | struct acpi_hest_aer_common *p; | 56 | struct acpi_hest_aer_common *p; |
| 41 | u8 pcie_type = 0; | ||
| 42 | u8 bridge = 0; | ||
| 43 | int ff = 0; | 57 | int ff = 0; |
| 44 | 58 | ||
| 45 | switch (hest_hdr->type) { | ||
| 46 | case ACPI_HEST_TYPE_AER_ROOT_PORT: | ||
| 47 | pcie_type = PCI_EXP_TYPE_ROOT_PORT; | ||
| 48 | break; | ||
| 49 | case ACPI_HEST_TYPE_AER_ENDPOINT: | ||
| 50 | pcie_type = PCI_EXP_TYPE_ENDPOINT; | ||
| 51 | break; | ||
| 52 | case ACPI_HEST_TYPE_AER_BRIDGE: | ||
| 53 | if ((info->pci_dev->class >> 16) == PCI_BASE_CLASS_BRIDGE) | ||
| 54 | bridge = 1; | ||
| 55 | break; | ||
| 56 | default: | ||
| 57 | return 0; | ||
| 58 | } | ||
| 59 | |||
| 60 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); | 59 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); |
| 61 | if (p->flags & ACPI_HEST_GLOBAL) { | 60 | if (p->flags & ACPI_HEST_GLOBAL) { |
| 62 | if ((pci_pcie_type(info->pci_dev) == pcie_type) || bridge) | 61 | if (hest_match_type(hest_hdr, info->pci_dev)) |
| 63 | ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); | 62 | ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); |
| 64 | } else | 63 | } else |
| 65 | if (hest_match_pci(p, info->pci_dev)) | 64 | if (hest_match_pci(p, info->pci_dev)) |
