diff options
author | Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> | 2010-04-15 00:10:53 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-05-11 15:01:13 -0400 |
commit | 843f4697eea576c24f057bbdb199115bbb6b10bc (patch) | |
tree | 889c40b06c3ca033733cf90f93184ec7917f9076 /drivers/pci | |
parent | 460d298d521910483dcdc09920ca4c4a63b16730 (diff) |
PCI: aerdrv: make aer_{en,dis}able_rootport static
These functions are only called from init/remove path of aerdrv,
so move them from aerdrv_core.c to aerdrv.c, to make them static.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv.c | 107 | ||||
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv.h | 2 | ||||
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_core.c | 107 |
3 files changed, 107 insertions, 109 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 14081f807e50..b69dbdc36817 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -72,6 +72,113 @@ void pci_no_aer(void) | |||
72 | pcie_aer_disable = 1; /* has priority over 'forceload' */ | 72 | pcie_aer_disable = 1; /* has priority over 'forceload' */ |
73 | } | 73 | } |
74 | 74 | ||
75 | static int set_device_error_reporting(struct pci_dev *dev, void *data) | ||
76 | { | ||
77 | bool enable = *((bool *)data); | ||
78 | |||
79 | if ((dev->pcie_type == PCI_EXP_TYPE_ROOT_PORT) || | ||
80 | (dev->pcie_type == PCI_EXP_TYPE_UPSTREAM) || | ||
81 | (dev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM)) { | ||
82 | if (enable) | ||
83 | pci_enable_pcie_error_reporting(dev); | ||
84 | else | ||
85 | pci_disable_pcie_error_reporting(dev); | ||
86 | } | ||
87 | |||
88 | if (enable) | ||
89 | pcie_set_ecrc_checking(dev); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports. | ||
96 | * @dev: pointer to root port's pci_dev data structure | ||
97 | * @enable: true = enable error reporting, false = disable error reporting. | ||
98 | */ | ||
99 | static void set_downstream_devices_error_reporting(struct pci_dev *dev, | ||
100 | bool enable) | ||
101 | { | ||
102 | set_device_error_reporting(dev, &enable); | ||
103 | |||
104 | if (!dev->subordinate) | ||
105 | return; | ||
106 | pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable); | ||
107 | } | ||
108 | |||
109 | /** | ||
110 | * aer_enable_rootport - enable Root Port's interrupts when receiving messages | ||
111 | * @rpc: pointer to a Root Port data structure | ||
112 | * | ||
113 | * Invoked when PCIe bus loads AER service driver. | ||
114 | */ | ||
115 | static void aer_enable_rootport(struct aer_rpc *rpc) | ||
116 | { | ||
117 | struct pci_dev *pdev = rpc->rpd->port; | ||
118 | int pos, aer_pos; | ||
119 | u16 reg16; | ||
120 | u32 reg32; | ||
121 | |||
122 | pos = pci_pcie_cap(pdev); | ||
123 | /* Clear PCIe Capability's Device Status */ | ||
124 | pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, ®16); | ||
125 | pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16); | ||
126 | |||
127 | /* Disable system error generation in response to error messages */ | ||
128 | pci_read_config_word(pdev, pos + PCI_EXP_RTCTL, ®16); | ||
129 | reg16 &= ~(SYSTEM_ERROR_INTR_ON_MESG_MASK); | ||
130 | pci_write_config_word(pdev, pos + PCI_EXP_RTCTL, reg16); | ||
131 | |||
132 | aer_pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR); | ||
133 | /* Clear error status */ | ||
134 | pci_read_config_dword(pdev, aer_pos + PCI_ERR_ROOT_STATUS, ®32); | ||
135 | pci_write_config_dword(pdev, aer_pos + PCI_ERR_ROOT_STATUS, reg32); | ||
136 | pci_read_config_dword(pdev, aer_pos + PCI_ERR_COR_STATUS, ®32); | ||
137 | pci_write_config_dword(pdev, aer_pos + PCI_ERR_COR_STATUS, reg32); | ||
138 | pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, ®32); | ||
139 | pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32); | ||
140 | |||
141 | /* | ||
142 | * Enable error reporting for the root port device and downstream port | ||
143 | * devices. | ||
144 | */ | ||
145 | set_downstream_devices_error_reporting(pdev, true); | ||
146 | |||
147 | /* Enable Root Port's interrupt in response to error messages */ | ||
148 | pci_read_config_dword(pdev, aer_pos + PCI_ERR_ROOT_COMMAND, ®32); | ||
149 | reg32 |= ROOT_PORT_INTR_ON_MESG_MASK; | ||
150 | pci_write_config_dword(pdev, aer_pos + PCI_ERR_ROOT_COMMAND, reg32); | ||
151 | } | ||
152 | |||
153 | /** | ||
154 | * aer_disable_rootport - disable Root Port's interrupts when receiving messages | ||
155 | * @rpc: pointer to a Root Port data structure | ||
156 | * | ||
157 | * Invoked when PCIe bus unloads AER service driver. | ||
158 | */ | ||
159 | static void aer_disable_rootport(struct aer_rpc *rpc) | ||
160 | { | ||
161 | struct pci_dev *pdev = rpc->rpd->port; | ||
162 | u32 reg32; | ||
163 | int pos; | ||
164 | |||
165 | /* | ||
166 | * Disable error reporting for the root port device and downstream port | ||
167 | * devices. | ||
168 | */ | ||
169 | set_downstream_devices_error_reporting(pdev, false); | ||
170 | |||
171 | pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR); | ||
172 | /* Disable Root's interrupt in response to error messages */ | ||
173 | pci_read_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, ®32); | ||
174 | reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK; | ||
175 | pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, reg32); | ||
176 | |||
177 | /* Clear Root's error status reg */ | ||
178 | pci_read_config_dword(pdev, pos + PCI_ERR_ROOT_STATUS, ®32); | ||
179 | pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_STATUS, reg32); | ||
180 | } | ||
181 | |||
75 | /** | 182 | /** |
76 | * aer_irq - Root Port's ISR | 183 | * aer_irq - Root Port's ISR |
77 | * @irq: IRQ assigned to Root Port | 184 | * @irq: IRQ assigned to Root Port |
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h index b6fc5389dd09..2f345405e823 100644 --- a/drivers/pci/pcie/aer/aerdrv.h +++ b/drivers/pci/pcie/aer/aerdrv.h | |||
@@ -117,8 +117,6 @@ static inline pci_ers_result_t merge_result(enum pci_ers_result orig, | |||
117 | } | 117 | } |
118 | 118 | ||
119 | extern struct bus_type pcie_port_bus_type; | 119 | extern struct bus_type pcie_port_bus_type; |
120 | extern void aer_enable_rootport(struct aer_rpc *rpc); | ||
121 | extern void aer_disable_rootport(struct aer_rpc *rpc); | ||
122 | extern int aer_init(struct pcie_device *dev); | 120 | extern int aer_init(struct pcie_device *dev); |
123 | extern void aer_isr(struct work_struct *work); | 121 | extern void aer_isr(struct work_struct *work); |
124 | extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); | 122 | extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 0dcbae126834..ad15eea54fd0 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -99,40 +99,6 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) | |||
99 | } | 99 | } |
100 | EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); | 100 | EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); |
101 | 101 | ||
102 | static int set_device_error_reporting(struct pci_dev *dev, void *data) | ||
103 | { | ||
104 | bool enable = *((bool *)data); | ||
105 | |||
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)) { | ||
109 | if (enable) | ||
110 | pci_enable_pcie_error_reporting(dev); | ||
111 | else | ||
112 | pci_disable_pcie_error_reporting(dev); | ||
113 | } | ||
114 | |||
115 | if (enable) | ||
116 | pcie_set_ecrc_checking(dev); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | /** | ||
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. | ||
125 | */ | ||
126 | static void set_downstream_devices_error_reporting(struct pci_dev *dev, | ||
127 | bool enable) | ||
128 | { | ||
129 | set_device_error_reporting(dev, &enable); | ||
130 | |||
131 | if (!dev->subordinate) | ||
132 | return; | ||
133 | pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable); | ||
134 | } | ||
135 | |||
136 | static inline int compare_device_id(struct pci_dev *dev, | 102 | static inline int compare_device_id(struct pci_dev *dev, |
137 | struct aer_err_info *e_info) | 103 | struct aer_err_info *e_info) |
138 | { | 104 | { |
@@ -585,79 +551,6 @@ static void handle_error_source(struct pcie_device *aerdev, | |||
585 | } | 551 | } |
586 | 552 | ||
587 | /** | 553 | /** |
588 | * aer_enable_rootport - enable Root Port's interrupts when receiving messages | ||
589 | * @rpc: pointer to a Root Port data structure | ||
590 | * | ||
591 | * Invoked when PCIe bus loads AER service driver. | ||
592 | */ | ||
593 | void aer_enable_rootport(struct aer_rpc *rpc) | ||
594 | { | ||
595 | struct pci_dev *pdev = rpc->rpd->port; | ||
596 | int pos, aer_pos; | ||
597 | u16 reg16; | ||
598 | u32 reg32; | ||
599 | |||
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); | ||
604 | |||
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); | ||
609 | |||
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); | ||
618 | |||
619 | /* | ||
620 | * Enable error reporting for the root port device and downstream port | ||
621 | * devices. | ||
622 | */ | ||
623 | set_downstream_devices_error_reporting(pdev, true); | ||
624 | |||
625 | /* Enable Root Port's interrupt in response to error messages */ | ||
626 | pci_read_config_dword(pdev, aer_pos + PCI_ERR_ROOT_COMMAND, ®32); | ||
627 | reg32 |= ROOT_PORT_INTR_ON_MESG_MASK; | ||
628 | pci_write_config_dword(pdev, aer_pos + PCI_ERR_ROOT_COMMAND, reg32); | ||
629 | } | ||
630 | |||
631 | /** | ||
632 | * aer_disable_rootport - disable Root Port's interrupts when receiving messages | ||
633 | * @rpc: pointer to a Root Port data structure | ||
634 | * | ||
635 | * Invoked when PCIe bus unloads AER service driver. | ||
636 | */ | ||
637 | void aer_disable_rootport(struct aer_rpc *rpc) | ||
638 | { | ||
639 | struct pci_dev *pdev = rpc->rpd->port; | ||
640 | u32 reg32; | ||
641 | int pos; | ||
642 | |||
643 | /* | ||
644 | * Disable error reporting for the root port device and downstream port | ||
645 | * devices. | ||
646 | */ | ||
647 | set_downstream_devices_error_reporting(pdev, false); | ||
648 | |||
649 | pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR); | ||
650 | /* Disable Root's interrupt in response to error messages */ | ||
651 | pci_read_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, ®32); | ||
652 | reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK; | ||
653 | pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, reg32); | ||
654 | |||
655 | /* Clear Root's error status reg */ | ||
656 | pci_read_config_dword(pdev, pos + PCI_ERR_ROOT_STATUS, ®32); | ||
657 | pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_STATUS, reg32); | ||
658 | } | ||
659 | |||
660 | /** | ||
661 | * get_e_source - retrieve an error source | 554 | * get_e_source - retrieve an error source |
662 | * @rpc: pointer to the root port which holds an error | 555 | * @rpc: pointer to the root port which holds an error |
663 | * | 556 | * |