2 * drivers/pci/pcie/aer/aerdrv_core.c
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * This file implements the core part of PCI-Express AER. When an pci-express
9 * error is delivered, an error message will be collected and printed to
10 * console, then, an error recovery procedure will be executed by following
11 * the pci error recovery rules.
13 * Copyright (C) 2006 Intel Corp.
14 * Tom Long Nguyen (tom.l.nguyen@intel.com)
15 * Zhang Yanmin (yanmin.zhang@intel.com)
19 #include <linux/module.h>
20 #include <linux/pci.h>
21 #include <linux/kernel.h>
22 #include <linux/errno.h>
24 #include <linux/suspend.h>
25 #include <linux/delay.h>
26 #include <linux/slab.h>
30 static int nosourceid
;
31 module_param(forceload
, bool, 0);
32 module_param(nosourceid
, bool, 0);
34 int pci_enable_pcie_error_reporting(struct pci_dev
*dev
)
39 if (dev
->aer_firmware_first
)
42 pos
= pci_find_ext_capability(dev
, PCI_EXT_CAP_ID_ERR
);
46 pos
= pci_pcie_cap(dev
);
50 pci_read_config_word(dev
, pos
+PCI_EXP_DEVCTL
, ®16
);
53 PCI_EXP_DEVCTL_NFERE
|
56 pci_write_config_word(dev
, pos
+PCI_EXP_DEVCTL
, reg16
);
60 EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting
);
62 int pci_disable_pcie_error_reporting(struct pci_dev
*dev
)
67 if (dev
->aer_firmware_first
)
70 pos
= pci_pcie_cap(dev
);
74 pci_read_config_word(dev
, pos
+PCI_EXP_DEVCTL
, ®16
);
75 reg16
= reg16
& ~(PCI_EXP_DEVCTL_CERE
|
76 PCI_EXP_DEVCTL_NFERE
|
79 pci_write_config_word(dev
, pos
+PCI_EXP_DEVCTL
, reg16
);
83 EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting
);
85 int pci_cleanup_aer_uncorrect_error_status(struct pci_dev
*dev
)
90 pos
= pci_find_ext_capability(dev
, PCI_EXT_CAP_ID_ERR
);
94 pci_read_config_dword(dev
, pos
+ PCI_ERR_UNCOR_STATUS
, &status
);
96 pci_write_config_dword(dev
, pos
+ PCI_ERR_UNCOR_STATUS
, status
);
100 EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status
);
102 static int set_device_error_reporting(struct pci_dev
*dev
, void *data
)
104 bool enable
= *((bool *)data
);
106 if ((dev
->pcie_type
== PCI_EXP_TYPE_ROOT_PORT
) ||
107 (dev
->pcie_type
== PCI_EXP_TYPE_UPSTREAM
) ||
108 (dev
->pcie_type
== PCI_EXP_TYPE_DOWNSTREAM
)) {
110 pci_enable_pcie_error_reporting(dev
);
112 pci_disable_pcie_error_reporting(dev
);
116 pcie_set_ecrc_checking(dev
);
122 * set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports.
123 * @dev: pointer to root port's pci_dev data structure
124 * @enable: true = enable error reporting, false = disable error reporting.
126 static void set_downstream_devices_error_reporting(struct pci_dev
*dev
,
129 set_device_error_reporting(dev
, &enable
);
131 if (!dev
->subordinate
)
133 pci_walk_bus(dev
->subordinate
, set_device_error_reporting
, &enable
);
136 static inline int compare_device_id(struct pci_dev
*dev
,
137 struct aer_err_info
*e_info
)
139 if (e_info
->id
== ((dev
->bus
->number
<< 8) | dev
->devfn
)) {
149 static int add_error_device(struct aer_err_info
*e_info
, struct pci_dev
*dev
)
151 if (e_info
->error_dev_num
< AER_MAX_MULTI_ERR_DEVICES
) {
152 e_info
->dev
[e_info
->error_dev_num
] = dev
;
153 e_info
->error_dev_num
++;
161 #define PCI_BUS(x) (((x) >> 8) & 0xff)
163 static int find_device_iter(struct pci_dev
*dev
, void *data
)
170 struct aer_err_info
*e_info
= (struct aer_err_info
*)data
;
173 * When bus id is equal to 0, it might be a bad id
174 * reported by root port.
176 if (!nosourceid
&& (PCI_BUS(e_info
->id
) != 0)) {
177 result
= compare_device_id(dev
, e_info
);
179 add_error_device(e_info
, dev
);
182 * If there is no multiple error, we stop
183 * or continue based on the id comparing.
185 if (!e_info
->multi_error_valid
)
189 * If there are multiple errors and id does match,
190 * We need continue to search other devices under
191 * the root port. Return 0 means that.
200 * 2) bus id is equal to 0. Some ports might lose the bus
201 * id of error source id;
202 * 3) There are multiple errors and prior id comparing fails;
203 * We check AER status registers to find the initial reporter.
205 if (atomic_read(&dev
->enable_cnt
) == 0)
207 pos
= pci_pcie_cap(dev
);
210 /* Check if AER is enabled */
211 pci_read_config_word(dev
, pos
+PCI_EXP_DEVCTL
, ®16
);
213 PCI_EXP_DEVCTL_CERE
|
214 PCI_EXP_DEVCTL_NFERE
|
215 PCI_EXP_DEVCTL_FERE
|
216 PCI_EXP_DEVCTL_URRE
)))
218 pos
= pci_find_ext_capability(dev
, PCI_EXT_CAP_ID_ERR
);
224 if (e_info
->severity
== AER_CORRECTABLE
) {
225 pci_read_config_dword(dev
, pos
+ PCI_ERR_COR_STATUS
, &status
);
226 pci_read_config_dword(dev
, pos
+ PCI_ERR_COR_MASK
, &mask
);
227 if (status
& ~mask
) {
228 add_error_device(e_info
, dev
);
232 pci_read_config_dword(dev
, pos
+ PCI_ERR_UNCOR_STATUS
, &status
);
233 pci_read_config_dword(dev
, pos
+ PCI_ERR_UNCOR_MASK
, &mask
);
234 if (status
& ~mask
) {
235 add_error_device(e_info
, dev
);
243 if (e_info
->multi_error_valid
)
250 * find_source_device - search through device hierarchy for source device
251 * @parent: pointer to Root Port pci_dev data structure
252 * @err_info: including detailed error information such like id
254 * Invoked when error is detected at the Root Port.
256 static void find_source_device(struct pci_dev
*parent
,
257 struct aer_err_info
*e_info
)
259 struct pci_dev
*dev
= parent
;
262 /* Is Root Port an agent that sends error message? */
263 result
= find_device_iter(dev
, e_info
);
267 pci_walk_bus(parent
->subordinate
, find_device_iter
, e_info
);
270 static int report_error_detected(struct pci_dev
*dev
, void *data
)
272 pci_ers_result_t vote
;
273 struct pci_error_handlers
*err_handler
;
274 struct aer_broadcast_data
*result_data
;
275 result_data
= (struct aer_broadcast_data
*) data
;
277 dev
->error_state
= result_data
->state
;
280 !dev
->driver
->err_handler
||
281 !dev
->driver
->err_handler
->error_detected
) {
282 if (result_data
->state
== pci_channel_io_frozen
&&
283 !(dev
->hdr_type
& PCI_HEADER_TYPE_BRIDGE
)) {
285 * In case of fatal recovery, if one of down-
286 * stream device has no driver. We might be
287 * unable to recover because a later insmod
288 * of a driver for this device is unaware of
291 dev_printk(KERN_DEBUG
, &dev
->dev
, "device has %s\n",
293 "no AER-aware driver" : "no driver");
298 err_handler
= dev
->driver
->err_handler
;
299 vote
= err_handler
->error_detected(dev
, result_data
->state
);
300 result_data
->result
= merge_result(result_data
->result
, vote
);
304 static int report_mmio_enabled(struct pci_dev
*dev
, void *data
)
306 pci_ers_result_t vote
;
307 struct pci_error_handlers
*err_handler
;
308 struct aer_broadcast_data
*result_data
;
309 result_data
= (struct aer_broadcast_data
*) data
;
312 !dev
->driver
->err_handler
||
313 !dev
->driver
->err_handler
->mmio_enabled
)
316 err_handler
= dev
->driver
->err_handler
;
317 vote
= err_handler
->mmio_enabled(dev
);
318 result_data
->result
= merge_result(result_data
->result
, vote
);
322 static int report_slot_reset(struct pci_dev
*dev
, void *data
)
324 pci_ers_result_t vote
;
325 struct pci_error_handlers
*err_handler
;
326 struct aer_broadcast_data
*result_data
;
327 result_data
= (struct aer_broadcast_data
*) data
;
330 !dev
->driver
->err_handler
||
331 !dev
->driver
->err_handler
->slot_reset
)
334 err_handler
= dev
->driver
->err_handler
;
335 vote
= err_handler
->slot_reset(dev
);
336 result_data
->result
= merge_result(result_data
->result
, vote
);
340 static int report_resume(struct pci_dev
*dev
, void *data
)
342 struct pci_error_handlers
*err_handler
;
344 dev
->error_state
= pci_channel_io_normal
;
347 !dev
->driver
->err_handler
||
348 !dev
->driver
->err_handler
->resume
)
351 err_handler
= dev
->driver
->err_handler
;
352 err_handler
->resume(dev
);
357 * broadcast_error_message - handle message broadcast to downstream drivers
358 * @dev: pointer to from where in a hierarchy message is broadcasted down
359 * @state: error state
360 * @error_mesg: message to print
361 * @cb: callback to be broadcasted
363 * Invoked during error recovery process. Once being invoked, the content
364 * of error severity will be broadcasted to all downstream drivers in a
365 * hierarchy in question.
367 static pci_ers_result_t
broadcast_error_message(struct pci_dev
*dev
,
368 enum pci_channel_state state
,
370 int (*cb
)(struct pci_dev
*, void *))
372 struct aer_broadcast_data result_data
;
374 dev_printk(KERN_DEBUG
, &dev
->dev
, "broadcast %s message\n", error_mesg
);
375 result_data
.state
= state
;
376 if (cb
== report_error_detected
)
377 result_data
.result
= PCI_ERS_RESULT_CAN_RECOVER
;
379 result_data
.result
= PCI_ERS_RESULT_RECOVERED
;
381 if (dev
->hdr_type
& PCI_HEADER_TYPE_BRIDGE
) {
383 * If the error is reported by a bridge, we think this error
384 * is related to the downstream link of the bridge, so we
385 * do error recovery on all subordinates of the bridge instead
386 * of the bridge and clear the error status of the bridge.
388 if (cb
== report_error_detected
)
389 dev
->error_state
= state
;
390 pci_walk_bus(dev
->subordinate
, cb
, &result_data
);
391 if (cb
== report_resume
) {
392 pci_cleanup_aer_uncorrect_error_status(dev
);
393 dev
->error_state
= pci_channel_io_normal
;
397 * If the error is reported by an end point, we think this
398 * error is related to the upstream link of the end point.
400 pci_walk_bus(dev
->bus
, cb
, &result_data
);
403 return result_data
.result
;
406 struct find_aer_service_data
{
407 struct pcie_port_service_driver
*aer_driver
;
411 static int find_aer_service_iter(struct device
*device
, void *data
)
413 struct device_driver
*driver
;
414 struct pcie_port_service_driver
*service_driver
;
415 struct find_aer_service_data
*result
;
417 result
= (struct find_aer_service_data
*) data
;
419 if (device
->bus
== &pcie_port_bus_type
) {
420 struct pcie_device
*pcie
= to_pcie_device(device
);
422 if (pcie
->port
->pcie_type
== PCI_EXP_TYPE_DOWNSTREAM
)
423 result
->is_downstream
= 1;
425 driver
= device
->driver
;
427 service_driver
= to_service_driver(driver
);
428 if (service_driver
->service
== PCIE_PORT_SERVICE_AER
) {
429 result
->aer_driver
= service_driver
;
438 static void find_aer_service(struct pci_dev
*dev
,
439 struct find_aer_service_data
*data
)
442 retval
= device_for_each_child(&dev
->dev
, data
, find_aer_service_iter
);
445 static pci_ers_result_t
reset_link(struct pcie_device
*aerdev
,
448 struct pci_dev
*udev
;
449 pci_ers_result_t status
;
450 struct find_aer_service_data data
;
452 if (dev
->hdr_type
& PCI_HEADER_TYPE_BRIDGE
)
455 udev
= dev
->bus
->self
;
457 data
.is_downstream
= 0;
458 data
.aer_driver
= NULL
;
459 find_aer_service(udev
, &data
);
462 * Use the aer driver of the error agent firstly.
463 * If it hasn't the aer driver, use the root port's
465 if (!data
.aer_driver
|| !data
.aer_driver
->reset_link
) {
466 if (data
.is_downstream
&&
467 aerdev
->device
.driver
&&
468 to_service_driver(aerdev
->device
.driver
)->reset_link
) {
470 to_service_driver(aerdev
->device
.driver
);
472 dev_printk(KERN_DEBUG
, &dev
->dev
, "no link-reset "
474 return PCI_ERS_RESULT_DISCONNECT
;
478 status
= data
.aer_driver
->reset_link(udev
);
479 if (status
!= PCI_ERS_RESULT_RECOVERED
) {
480 dev_printk(KERN_DEBUG
, &dev
->dev
, "link reset at upstream "
481 "device %s failed\n", pci_name(udev
));
482 return PCI_ERS_RESULT_DISCONNECT
;
489 * do_recovery - handle nonfatal/fatal error recovery process
490 * @aerdev: pointer to a pcie_device data structure of root port
491 * @dev: pointer to a pci_dev data structure of agent detecting an error
492 * @severity: error severity type
494 * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast
495 * error detected message to all downstream drivers within a hierarchy in
496 * question and return the returned code.
498 static pci_ers_result_t
do_recovery(struct pcie_device
*aerdev
,
502 pci_ers_result_t status
, result
= PCI_ERS_RESULT_RECOVERED
;
503 enum pci_channel_state state
;
505 if (severity
== AER_FATAL
)
506 state
= pci_channel_io_frozen
;
508 state
= pci_channel_io_normal
;
510 status
= broadcast_error_message(dev
,
513 report_error_detected
);
515 if (severity
== AER_FATAL
) {
516 result
= reset_link(aerdev
, dev
);
517 if (result
!= PCI_ERS_RESULT_RECOVERED
) {
518 /* TODO: Should panic here? */
523 if (status
== PCI_ERS_RESULT_CAN_RECOVER
)
524 status
= broadcast_error_message(dev
,
527 report_mmio_enabled
);
529 if (status
== PCI_ERS_RESULT_NEED_RESET
) {
531 * TODO: Should call platform-specific
532 * functions to reset slot before calling
533 * drivers' slot_reset callbacks?
535 status
= broadcast_error_message(dev
,
541 if (status
== PCI_ERS_RESULT_RECOVERED
)
542 broadcast_error_message(dev
,
551 * handle_error_source - handle logging error into an event log
552 * @aerdev: pointer to pcie_device data structure of the root port
553 * @dev: pointer to pci_dev data structure of error source device
554 * @info: comprehensive error information
556 * Invoked when an error being detected by Root Port.
558 static void handle_error_source(struct pcie_device
*aerdev
,
560 struct aer_err_info
*info
)
562 pci_ers_result_t status
= 0;
565 if (info
->severity
== AER_CORRECTABLE
) {
567 * Correctable error does not need software intevention.
568 * No need to go through error recovery process.
570 pos
= pci_find_ext_capability(dev
, PCI_EXT_CAP_ID_ERR
);
572 pci_write_config_dword(dev
, pos
+ PCI_ERR_COR_STATUS
,
575 status
= do_recovery(aerdev
, dev
, info
->severity
);
576 if (status
== PCI_ERS_RESULT_RECOVERED
) {
577 dev_printk(KERN_DEBUG
, &dev
->dev
, "AER driver "
578 "successfully recovered\n");
580 /* TODO: Should kernel panic here? */
581 dev_printk(KERN_DEBUG
, &dev
->dev
, "AER driver didn't "
588 * aer_enable_rootport - enable Root Port's interrupts when receiving messages
589 * @rpc: pointer to a Root Port data structure
591 * Invoked when PCIe bus loads AER service driver.
593 void aer_enable_rootport(struct aer_rpc
*rpc
)
595 struct pci_dev
*pdev
= rpc
->rpd
->port
;
600 pos
= pci_pcie_cap(pdev
);
601 /* Clear PCIe Capability's Device Status */
602 pci_read_config_word(pdev
, pos
+PCI_EXP_DEVSTA
, ®16
);
603 pci_write_config_word(pdev
, pos
+PCI_EXP_DEVSTA
, reg16
);
605 /* Disable system error generation in response to error messages */
606 pci_read_config_word(pdev
, pos
+ PCI_EXP_RTCTL
, ®16
);
607 reg16
&= ~(SYSTEM_ERROR_INTR_ON_MESG_MASK
);
608 pci_write_config_word(pdev
, pos
+ PCI_EXP_RTCTL
, reg16
);
610 aer_pos
= pci_find_ext_capability(pdev
, PCI_EXT_CAP_ID_ERR
);
611 /* Clear error status */
612 pci_read_config_dword(pdev
, aer_pos
+ PCI_ERR_ROOT_STATUS
, ®32
);
613 pci_write_config_dword(pdev
, aer_pos
+ PCI_ERR_ROOT_STATUS
, reg32
);
614 pci_read_config_dword(pdev
, aer_pos
+ PCI_ERR_COR_STATUS
, ®32
);
615 pci_write_config_dword(pdev
, aer_pos
+ PCI_ERR_COR_STATUS
, reg32
);
616 pci_read_config_dword(pdev
, aer_pos
+ PCI_ERR_UNCOR_STATUS
, ®32
);
617 pci_write_config_dword(pdev
, aer_pos
+ PCI_ERR_UNCOR_STATUS
, reg32
);
620 * Enable error reporting for the root port device and downstream port
623 set_downstream_devices_error_reporting(pdev
, true);
625 /* Enable Root Port's interrupt in response to error messages */
626 pci_write_config_dword(pdev
,
627 aer_pos
+ PCI_ERR_ROOT_COMMAND
,
628 ROOT_PORT_INTR_ON_MESG_MASK
);
632 * disable_root_aer - disable Root Port's interrupts when receiving messages
633 * @rpc: pointer to a Root Port data structure
635 * Invoked when PCIe bus unloads AER service driver.
637 static void disable_root_aer(struct aer_rpc
*rpc
)
639 struct pci_dev
*pdev
= rpc
->rpd
->port
;
644 * Disable error reporting for the root port device and downstream port
647 set_downstream_devices_error_reporting(pdev
, false);
649 pos
= pci_find_ext_capability(pdev
, PCI_EXT_CAP_ID_ERR
);
650 /* Disable Root's interrupt in response to error messages */
651 pci_write_config_dword(pdev
, pos
+ PCI_ERR_ROOT_COMMAND
, 0);
653 /* Clear Root's error status reg */
654 pci_read_config_dword(pdev
, pos
+ PCI_ERR_ROOT_STATUS
, ®32
);
655 pci_write_config_dword(pdev
, pos
+ PCI_ERR_ROOT_STATUS
, reg32
);
659 * get_e_source - retrieve an error source
660 * @rpc: pointer to the root port which holds an error
662 * Invoked by DPC handler to consume an error.
664 static struct aer_err_source
*get_e_source(struct aer_rpc
*rpc
)
666 struct aer_err_source
*e_source
;
669 /* Lock access to Root error producer/consumer index */
670 spin_lock_irqsave(&rpc
->e_lock
, flags
);
671 if (rpc
->prod_idx
== rpc
->cons_idx
) {
672 spin_unlock_irqrestore(&rpc
->e_lock
, flags
);
675 e_source
= &rpc
->e_sources
[rpc
->cons_idx
];
677 if (rpc
->cons_idx
== AER_ERROR_SOURCES_MAX
)
679 spin_unlock_irqrestore(&rpc
->e_lock
, flags
);
685 * get_device_error_info - read error status from dev and store it to info
686 * @dev: pointer to the device expected to have a error record
687 * @info: pointer to structure to store the error record
689 * Return 1 on success, 0 on error.
691 static int get_device_error_info(struct pci_dev
*dev
, struct aer_err_info
*info
)
696 info
->tlp_header_valid
= 0;
698 pos
= pci_find_ext_capability(dev
, PCI_EXT_CAP_ID_ERR
);
700 /* The device might not support AER */
704 if (info
->severity
== AER_CORRECTABLE
) {
705 pci_read_config_dword(dev
, pos
+ PCI_ERR_COR_STATUS
,
707 pci_read_config_dword(dev
, pos
+ PCI_ERR_COR_MASK
,
709 if (!(info
->status
& ~info
->mask
))
711 } else if (dev
->hdr_type
& PCI_HEADER_TYPE_BRIDGE
||
712 info
->severity
== AER_NONFATAL
) {
714 /* Link is still healthy for IO reads */
715 pci_read_config_dword(dev
, pos
+ PCI_ERR_UNCOR_STATUS
,
717 pci_read_config_dword(dev
, pos
+ PCI_ERR_UNCOR_MASK
,
719 if (!(info
->status
& ~info
->mask
))
722 /* Get First Error Pointer */
723 pci_read_config_dword(dev
, pos
+ PCI_ERR_CAP
, &temp
);
724 info
->first_error
= PCI_ERR_CAP_FEP(temp
);
726 if (info
->status
& AER_LOG_TLP_MASKS
) {
727 info
->tlp_header_valid
= 1;
728 pci_read_config_dword(dev
,
729 pos
+ PCI_ERR_HEADER_LOG
, &info
->tlp
.dw0
);
730 pci_read_config_dword(dev
,
731 pos
+ PCI_ERR_HEADER_LOG
+ 4, &info
->tlp
.dw1
);
732 pci_read_config_dword(dev
,
733 pos
+ PCI_ERR_HEADER_LOG
+ 8, &info
->tlp
.dw2
);
734 pci_read_config_dword(dev
,
735 pos
+ PCI_ERR_HEADER_LOG
+ 12, &info
->tlp
.dw3
);
742 static inline void aer_process_err_devices(struct pcie_device
*p_device
,
743 struct aer_err_info
*e_info
)
747 if (!e_info
->dev
[0]) {
748 dev_printk(KERN_DEBUG
, &p_device
->port
->dev
,
749 "can't find device of ID%04x\n",
753 /* Report all before handle them, not to lost records by reset etc. */
754 for (i
= 0; i
< e_info
->error_dev_num
&& e_info
->dev
[i
]; i
++) {
755 if (get_device_error_info(e_info
->dev
[i
], e_info
))
756 aer_print_error(e_info
->dev
[i
], e_info
);
758 for (i
= 0; i
< e_info
->error_dev_num
&& e_info
->dev
[i
]; i
++) {
759 if (get_device_error_info(e_info
->dev
[i
], e_info
))
760 handle_error_source(p_device
, e_info
->dev
[i
], e_info
);
765 * aer_isr_one_error - consume an error detected by root port
766 * @p_device: pointer to error root port service device
767 * @e_src: pointer to an error source
769 static void aer_isr_one_error(struct pcie_device
*p_device
,
770 struct aer_err_source
*e_src
)
772 struct aer_err_info
*e_info
;
775 /* struct aer_err_info might be big, so we allocate it with slab */
776 e_info
= kmalloc(sizeof(struct aer_err_info
), GFP_KERNEL
);
777 if (e_info
== NULL
) {
778 dev_printk(KERN_DEBUG
, &p_device
->port
->dev
,
779 "Can't allocate mem when processing AER errors\n");
784 * There is a possibility that both correctable error and
785 * uncorrectable error being logged. Report correctable error first.
787 for (i
= 1; i
& ROOT_ERR_STATUS_MASKS
; i
<<= 2) {
790 if (!(e_src
->status
& i
))
793 memset(e_info
, 0, sizeof(struct aer_err_info
));
795 /* Init comprehensive error information */
796 if (i
& PCI_ERR_ROOT_COR_RCV
) {
797 e_info
->id
= ERR_COR_ID(e_src
->id
);
798 e_info
->severity
= AER_CORRECTABLE
;
800 e_info
->id
= ERR_UNCOR_ID(e_src
->id
);
801 e_info
->severity
= ((e_src
->status
>> 6) & 1);
804 (PCI_ERR_ROOT_MULTI_COR_RCV
|
805 PCI_ERR_ROOT_MULTI_UNCOR_RCV
))
806 e_info
->multi_error_valid
= 1;
808 aer_print_port_info(p_device
->port
, e_info
);
810 find_source_device(p_device
->port
, e_info
);
811 aer_process_err_devices(p_device
, e_info
);
818 * aer_isr - consume errors detected by root port
819 * @work: definition of this work item
821 * Invoked, as DPC, when root port records new detected error
823 void aer_isr(struct work_struct
*work
)
825 struct aer_rpc
*rpc
= container_of(work
, struct aer_rpc
, dpc_handler
);
826 struct pcie_device
*p_device
= rpc
->rpd
;
827 struct aer_err_source
*e_src
;
829 mutex_lock(&rpc
->rpc_mutex
);
830 e_src
= get_e_source(rpc
);
832 aer_isr_one_error(p_device
, e_src
);
833 e_src
= get_e_source(rpc
);
835 mutex_unlock(&rpc
->rpc_mutex
);
837 wake_up(&rpc
->wait_release
);
841 * aer_delete_rootport - disable root port aer and delete service data
842 * @rpc: pointer to a root port device being deleted
844 * Invoked when AER service unloaded on a specific Root Port
846 void aer_delete_rootport(struct aer_rpc
*rpc
)
848 /* Disable root port AER itself */
849 disable_root_aer(rpc
);
855 * aer_init - provide AER initialization
856 * @dev: pointer to AER pcie device
858 * Invoked when AER service driver is loaded.
860 int aer_init(struct pcie_device
*dev
)
862 if (dev
->port
->aer_firmware_first
) {
863 dev_printk(KERN_DEBUG
, &dev
->device
,
864 "PCIe errors handled by platform firmware.\n");
868 if (aer_osc_setup(dev
))
874 dev_printk(KERN_DEBUG
, &dev
->device
,
875 "aerdrv forceload requested.\n");
876 dev
->port
->aer_firmware_first
= 0;