aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/pcie/aer/aerdrv_errprint.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
index a2a4b3903a7a..95c3f1ca8076 100644
--- a/drivers/pci/pcie/aer/aerdrv_errprint.c
+++ b/drivers/pci/pcie/aer/aerdrv_errprint.c
@@ -152,38 +152,31 @@ static char *aer_agent_string[] = {
152 "Transmitter ID" 152 "Transmitter ID"
153}; 153};
154 154
155static char *aer_get_error_source_name(int severity, 155static void aer_print_error_source(struct aer_err_info *info)
156 unsigned int status,
157 char errmsg_buff[])
158{ 156{
159 int i; 157 int i;
160 char *errmsg = NULL; 158 char *errmsg = NULL;
161 159
162 for (i = 0; i < 32; i++) { 160 for (i = 0; i < 32; i++) {
163 if (!(status & (1 << i))) 161 if (!(info->status & (1 << i)))
164 continue; 162 continue;
165 163
166 if (severity == AER_CORRECTABLE) 164 if (info->severity == AER_CORRECTABLE)
167 errmsg = aer_correctable_error_string[i]; 165 errmsg = aer_correctable_error_string[i];
168 else 166 else
169 errmsg = aer_uncorrectable_error_string[i]; 167 errmsg = aer_uncorrectable_error_string[i];
170 168
171 if (!errmsg) { 169 if (errmsg)
172 sprintf(errmsg_buff, "Unknown Error Bit %2d ", i); 170 AER_PR(info, "%s\t:\n", errmsg);
173 errmsg = errmsg_buff; 171 else
174 } 172 AER_PR(info, "Unknown Error Bit %2d \t:\n", i);
175 173
176 break; 174 break;
177 } 175 }
178
179 return errmsg;
180} 176}
181 177
182static DEFINE_SPINLOCK(logbuf_lock);
183static char errmsg_buff[100];
184void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) 178void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
185{ 179{
186 char *errmsg;
187 int err_layer, agent; 180 int err_layer, agent;
188 int id = ((dev->bus->number << 8) | dev->devfn); 181 int id = ((dev->bus->number << 8) | dev->devfn);
189 182
@@ -199,12 +192,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
199 AER_PR(info, "PCIE Bus Error type\t: %s\n", 192 AER_PR(info, "PCIE Bus Error type\t: %s\n",
200 aer_error_layer[err_layer]); 193 aer_error_layer[err_layer]);
201 194
202 spin_lock(&logbuf_lock); 195 aer_print_error_source(info);
203 errmsg = aer_get_error_source_name(info->severity,
204 info->status,
205 errmsg_buff);
206 AER_PR(info, "%s\t:\n", errmsg);
207 spin_unlock(&logbuf_lock);
208 196
209 agent = AER_GET_AGENT(info->severity, info->status); 197 agent = AER_GET_AGENT(info->severity, info->status);
210 AER_PR(info, "%s\t\t: %04x\n", aer_agent_string[agent], id); 198 AER_PR(info, "%s\t\t: %04x\n", aer_agent_string[agent], id);