diff options
author | Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> | 2009-09-07 04:16:45 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-09-09 16:50:05 -0400 |
commit | 79e4b89be81b5e53bc4cb51788ca7a45cadb4ef3 (patch) | |
tree | 846f21ae6628559b68778d2e438ac3503c76ca79 | |
parent | 273024ded7b364e1305a31bf4eb197870284f279 (diff) |
PCI: pcie, aer: change error print format
Use dev_printk like format.
Sample (real machine + dummy error injected by aer-inject):
- Before:
+------ PCI-Express Device Error ------+
Error Severity : Corrected
PCIE Bus Error type : Data Link Layer
Bad TLP :
Receiver ID : 2800
VendorID=8086h, DeviceID=1096h, Bus=28h, Device=00h, Function=00h
+------ PCI-Express Device Error ------+
Error Severity : Corrected
PCIE Bus Error type : Data Link Layer
Bad TLP :
Bad DLLP :
Receiver ID : 2801
VendorID=8086h, DeviceID=1096h, Bus=28h, Device=00h, Function=01h
Error of this Agent(2801) is reported first
- After:
pcieport-driver 0000:00:02.0: AER: Multiple Corrected error received: id=2801
e1000e 0000:28:00.0: PCIE Bus Error: severity=Corrected, type=Data Link Layer, id=2800(Receiver ID)
e1000e 0000:28:00.0: device [8086:1096] error status/mask=00000040/00000000
e1000e 0000:28:00.0: [ 6] Bad TLP
e1000e 0000:28:00.1: PCIE Bus Error: severity=Corrected, type=Data Link Layer, id=2801(Receiver ID)
e1000e 0000:28:00.1: device [8086:1096] error status/mask=000000c0/00000000
e1000e 0000:28:00.1: [ 6] Bad TLP
e1000e 0000:28:00.1: [ 7] Bad DLLP
e1000e 0000:28:00.1: Error of this Agent(2801) is reported first
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv.h | 1 | ||||
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_errprint.c | 68 |
3 files changed, 39 insertions, 32 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h index 78c977cec479..f9979eb56fb2 100644 --- a/drivers/pci/pcie/aer/aerdrv.h +++ b/drivers/pci/pcie/aer/aerdrv.h | |||
@@ -124,6 +124,7 @@ extern void aer_delete_rootport(struct aer_rpc *rpc); | |||
124 | extern int aer_init(struct pcie_device *dev); | 124 | extern int aer_init(struct pcie_device *dev); |
125 | extern void aer_isr(struct work_struct *work); | 125 | extern void aer_isr(struct work_struct *work); |
126 | extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); | 126 | extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); |
127 | extern void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info); | ||
127 | extern irqreturn_t aer_irq(int irq, void *context); | 128 | extern irqreturn_t aer_irq(int irq, void *context); |
128 | 129 | ||
129 | #ifdef CONFIG_ACPI | 130 | #ifdef CONFIG_ACPI |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 962646974466..d9185cd2d900 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -813,6 +813,8 @@ static void aer_isr_one_error(struct pcie_device *p_device, | |||
813 | PCI_ERR_ROOT_MULTI_UNCOR_RCV)) | 813 | PCI_ERR_ROOT_MULTI_UNCOR_RCV)) |
814 | e_info->multi_error_valid = 1; | 814 | e_info->multi_error_valid = 1; |
815 | 815 | ||
816 | aer_print_port_info(p_device->port, e_info); | ||
817 | |||
816 | find_source_device(p_device->port, e_info); | 818 | find_source_device(p_device->port, e_info); |
817 | aer_process_err_devices(p_device, e_info); | 819 | aer_process_err_devices(p_device, e_info); |
818 | } | 820 | } |
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index f0bdf0ff859e..44acde72294f 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c | |||
@@ -57,9 +57,10 @@ | |||
57 | (e & AER_DATA_LINK_LAYER_ERROR_MASK(t)) ? AER_DATA_LINK_LAYER_ERROR : \ | 57 | (e & AER_DATA_LINK_LAYER_ERROR_MASK(t)) ? AER_DATA_LINK_LAYER_ERROR : \ |
58 | AER_TRANSACTION_LAYER_ERROR) | 58 | AER_TRANSACTION_LAYER_ERROR) |
59 | 59 | ||
60 | #define AER_PR(info, fmt, args...) \ | 60 | #define AER_PR(info, pdev, fmt, args...) \ |
61 | printk("%s" fmt, (info->severity == AER_CORRECTABLE) ? \ | 61 | printk("%s%s %s: " fmt, (info->severity == AER_CORRECTABLE) ? \ |
62 | KERN_WARNING : KERN_ERR, ## args) | 62 | KERN_WARNING : KERN_ERR, dev_driver_string(&pdev->dev), \ |
63 | dev_name(&pdev->dev), ## args) | ||
63 | 64 | ||
64 | /* | 65 | /* |
65 | * AER error strings | 66 | * AER error strings |
@@ -152,7 +153,7 @@ static char *aer_agent_string[] = { | |||
152 | "Transmitter ID" | 153 | "Transmitter ID" |
153 | }; | 154 | }; |
154 | 155 | ||
155 | static void aer_print_error_source(struct aer_err_info *info) | 156 | static void __aer_print_error(struct aer_err_info *info, struct pci_dev *dev) |
156 | { | 157 | { |
157 | int i, status; | 158 | int i, status; |
158 | char *errmsg = NULL; | 159 | char *errmsg = NULL; |
@@ -169,48 +170,44 @@ static void aer_print_error_source(struct aer_err_info *info) | |||
169 | errmsg = aer_uncorrectable_error_string[i]; | 170 | errmsg = aer_uncorrectable_error_string[i]; |
170 | 171 | ||
171 | if (errmsg) | 172 | if (errmsg) |
172 | AER_PR(info, "%s\t: %s\n", errmsg, | 173 | AER_PR(info, dev, " [%2d] %s%s\n", i, errmsg, |
173 | info->first_error == i ? "First" : ""); | 174 | info->first_error == i ? " (First)" : ""); |
174 | else | 175 | else |
175 | AER_PR(info, "Unknown Error Bit %2d \t: %s\n", | 176 | AER_PR(info, dev, " [%2d] Unknown Error Bit%s\n", i, |
176 | i, info->first_error == i ? "First" : ""); | 177 | info->first_error == i ? " (First)" : ""); |
177 | } | 178 | } |
178 | } | 179 | } |
179 | 180 | ||
180 | void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | 181 | void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) |
181 | { | 182 | { |
182 | int err_layer, agent; | ||
183 | int id = ((dev->bus->number << 8) | dev->devfn); | 183 | int id = ((dev->bus->number << 8) | dev->devfn); |
184 | 184 | ||
185 | AER_PR(info, "+------ PCI-Express Device Error ------+\n"); | ||
186 | AER_PR(info, "Error Severity\t\t: %s\n", | ||
187 | aer_error_severity_string[info->severity]); | ||
188 | |||
189 | if (info->status == 0) { | 185 | if (info->status == 0) { |
190 | AER_PR(info, "PCIE Bus Error type\t: (Unaccessible)\n"); | 186 | AER_PR(info, dev, |
191 | AER_PR(info, "Unregistered Agent ID\t: %04x\n", id); | 187 | "PCIE Bus Error: severity=%s, type=Unaccessible, " |
188 | "id=%04x(Unregistered Agent ID)\n", | ||
189 | aer_error_severity_string[info->severity], id); | ||
192 | } else { | 190 | } else { |
193 | err_layer = AER_GET_LAYER_ERROR(info->severity, info->status); | 191 | int layer, agent; |
194 | AER_PR(info, "PCIE Bus Error type\t: %s\n", | ||
195 | aer_error_layer[err_layer]); | ||
196 | |||
197 | aer_print_error_source(info); | ||
198 | 192 | ||
193 | layer = AER_GET_LAYER_ERROR(info->severity, info->status); | ||
199 | agent = AER_GET_AGENT(info->severity, info->status); | 194 | agent = AER_GET_AGENT(info->severity, info->status); |
200 | AER_PR(info, "%s\t\t: %04x\n", aer_agent_string[agent], id); | ||
201 | 195 | ||
202 | AER_PR(info, "VendorID=%04xh, DeviceID=%04xh," | 196 | AER_PR(info, dev, |
203 | " Bus=%02xh, Device=%02xh, Function=%02xh\n", | 197 | "PCIE Bus Error: severity=%s, type=%s, id=%04x(%s)\n", |
204 | dev->vendor, | 198 | aer_error_severity_string[info->severity], |
205 | dev->device, | 199 | aer_error_layer[layer], id, aer_agent_string[agent]); |
206 | dev->bus->number, | 200 | |
207 | PCI_SLOT(dev->devfn), | 201 | AER_PR(info, dev, |
208 | PCI_FUNC(dev->devfn)); | 202 | " device [%04x:%04x] error status/mask=%08x/%08x\n", |
203 | dev->vendor, dev->device, info->status, info->mask); | ||
204 | |||
205 | __aer_print_error(info, dev); | ||
209 | 206 | ||
210 | if (info->tlp_header_valid) { | 207 | if (info->tlp_header_valid) { |
211 | unsigned char *tlp = (unsigned char *) &info->tlp; | 208 | unsigned char *tlp = (unsigned char *) &info->tlp; |
212 | AER_PR(info, "TLP Header:\n"); | 209 | AER_PR(info, dev, " TLP Header:" |
213 | AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x" | 210 | " %02x%02x%02x%02x %02x%02x%02x%02x" |
214 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", | 211 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", |
215 | *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, | 212 | *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, |
216 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), | 213 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), |
@@ -221,6 +218,13 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
221 | } | 218 | } |
222 | 219 | ||
223 | if (info->id && info->error_dev_num > 1 && info->id == id) | 220 | if (info->id && info->error_dev_num > 1 && info->id == id) |
224 | AER_PR(info, "Error of this Agent(%04x) is reported first\n", | 221 | AER_PR(info, dev, |
225 | id); | 222 | " Error of this Agent(%04x) is reported first\n", id); |
223 | } | ||
224 | |||
225 | void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) | ||
226 | { | ||
227 | dev_info(&dev->dev, "AER: %s%s error received: id=%04x\n", | ||
228 | info->multi_error_valid ? "Multiple " : "", | ||
229 | aer_error_severity_string[info->severity], info->id); | ||
226 | } | 230 | } |