diff options
| -rw-r--r-- | drivers/pci/pcie/aer/aerdrv_acpi.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c index a23995749f1d..4d6991794fa2 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c | |||
| @@ -70,6 +70,17 @@ static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data) | |||
| 70 | 70 | ||
| 71 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); | 71 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); |
| 72 | ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); | 72 | ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); |
| 73 | |||
| 74 | /* | ||
| 75 | * If no specific device is supplied, determine whether | ||
| 76 | * FIRMWARE_FIRST is set for *any* PCIe device. | ||
| 77 | */ | ||
| 78 | if (!info->pci_dev) { | ||
| 79 | info->firmware_first |= ff; | ||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | /* Otherwise, check the specific device */ | ||
| 73 | if (p->flags & ACPI_HEST_GLOBAL) { | 84 | if (p->flags & ACPI_HEST_GLOBAL) { |
| 74 | if (hest_match_type(hest_hdr, info->pci_dev)) | 85 | if (hest_match_type(hest_hdr, info->pci_dev)) |
| 75 | info->firmware_first = ff; | 86 | info->firmware_first = ff; |
| @@ -109,30 +120,20 @@ int pcie_aer_get_firmware_first(struct pci_dev *dev) | |||
| 109 | 120 | ||
| 110 | static bool aer_firmware_first; | 121 | static bool aer_firmware_first; |
| 111 | 122 | ||
| 112 | static int aer_hest_parse_aff(struct acpi_hest_header *hest_hdr, void *data) | ||
| 113 | { | ||
| 114 | struct acpi_hest_aer_common *p; | ||
| 115 | |||
| 116 | if (aer_firmware_first) | ||
| 117 | return 0; | ||
| 118 | |||
| 119 | if (!hest_source_is_pcie_aer(hest_hdr)) | ||
| 120 | return 0; | ||
| 121 | |||
| 122 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); | ||
| 123 | aer_firmware_first = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | /** | 123 | /** |
| 128 | * aer_acpi_firmware_first - Check if APEI should control AER. | 124 | * aer_acpi_firmware_first - Check if APEI should control AER. |
| 129 | */ | 125 | */ |
| 130 | bool aer_acpi_firmware_first(void) | 126 | bool aer_acpi_firmware_first(void) |
| 131 | { | 127 | { |
| 132 | static bool parsed = false; | 128 | static bool parsed = false; |
| 129 | struct aer_hest_parse_info info = { | ||
| 130 | .pci_dev = NULL, /* Check all PCIe devices */ | ||
| 131 | .firmware_first = 0, | ||
| 132 | }; | ||
| 133 | 133 | ||
| 134 | if (!parsed) { | 134 | if (!parsed) { |
| 135 | apei_hest_parse(aer_hest_parse_aff, NULL); | 135 | apei_hest_parse(aer_hest_parse, &info); |
| 136 | aer_firmware_first = info.firmware_first; | ||
| 136 | parsed = true; | 137 | parsed = true; |
| 137 | } | 138 | } |
| 138 | return aer_firmware_first; | 139 | return aer_firmware_first; |
