diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2015-03-17 01:15:07 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-03-23 22:15:52 -0400 |
commit | 0bd785873c6a6c9bd50d2ae19862f69ee5759fb9 (patch) | |
tree | c4408a1255810e0a5ebbd433892724f42f972047 /arch/powerpc/kernel | |
parent | ff57b454ddb938d98d48d8df356357000fedc88c (diff) |
powerpc/eeh: Replace device_node with pci_dn in eeh_ops
There are 3 EEH operations whose arguments contain device_node:
read_config(), write_config() and restore_config(). The patch
replaces device_node with pci_dn.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/eeh.c | 40 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh_pe.c | 82 |
2 files changed, 62 insertions, 60 deletions
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 9504c2f0bb54..1fd2566c87f1 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c | |||
@@ -164,30 +164,34 @@ __setup("eeh=", eeh_setup); | |||
164 | */ | 164 | */ |
165 | static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len) | 165 | static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len) |
166 | { | 166 | { |
167 | struct device_node *dn = eeh_dev_to_of_node(edev); | 167 | struct pci_dn *pdn = eeh_dev_to_pdn(edev); |
168 | u32 cfg; | 168 | u32 cfg; |
169 | int cap, i; | 169 | int cap, i; |
170 | int n = 0, l = 0; | 170 | int n = 0, l = 0; |
171 | char buffer[128]; | 171 | char buffer[128]; |
172 | 172 | ||
173 | n += scnprintf(buf+n, len-n, "%s\n", dn->full_name); | 173 | n += scnprintf(buf+n, len-n, "%04x:%02x:%02x:%01x\n", |
174 | pr_warn("EEH: of node=%s\n", dn->full_name); | 174 | edev->phb->global_number, pdn->busno, |
175 | PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn)); | ||
176 | pr_warn("EEH: of node=%04x:%02x:%02x:%01x\n", | ||
177 | edev->phb->global_number, pdn->busno, | ||
178 | PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn)); | ||
175 | 179 | ||
176 | eeh_ops->read_config(dn, PCI_VENDOR_ID, 4, &cfg); | 180 | eeh_ops->read_config(pdn, PCI_VENDOR_ID, 4, &cfg); |
177 | n += scnprintf(buf+n, len-n, "dev/vend:%08x\n", cfg); | 181 | n += scnprintf(buf+n, len-n, "dev/vend:%08x\n", cfg); |
178 | pr_warn("EEH: PCI device/vendor: %08x\n", cfg); | 182 | pr_warn("EEH: PCI device/vendor: %08x\n", cfg); |
179 | 183 | ||
180 | eeh_ops->read_config(dn, PCI_COMMAND, 4, &cfg); | 184 | eeh_ops->read_config(pdn, PCI_COMMAND, 4, &cfg); |
181 | n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); | 185 | n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); |
182 | pr_warn("EEH: PCI cmd/status register: %08x\n", cfg); | 186 | pr_warn("EEH: PCI cmd/status register: %08x\n", cfg); |
183 | 187 | ||
184 | /* Gather bridge-specific registers */ | 188 | /* Gather bridge-specific registers */ |
185 | if (edev->mode & EEH_DEV_BRIDGE) { | 189 | if (edev->mode & EEH_DEV_BRIDGE) { |
186 | eeh_ops->read_config(dn, PCI_SEC_STATUS, 2, &cfg); | 190 | eeh_ops->read_config(pdn, PCI_SEC_STATUS, 2, &cfg); |
187 | n += scnprintf(buf+n, len-n, "sec stat:%x\n", cfg); | 191 | n += scnprintf(buf+n, len-n, "sec stat:%x\n", cfg); |
188 | pr_warn("EEH: Bridge secondary status: %04x\n", cfg); | 192 | pr_warn("EEH: Bridge secondary status: %04x\n", cfg); |
189 | 193 | ||
190 | eeh_ops->read_config(dn, PCI_BRIDGE_CONTROL, 2, &cfg); | 194 | eeh_ops->read_config(pdn, PCI_BRIDGE_CONTROL, 2, &cfg); |
191 | n += scnprintf(buf+n, len-n, "brdg ctl:%x\n", cfg); | 195 | n += scnprintf(buf+n, len-n, "brdg ctl:%x\n", cfg); |
192 | pr_warn("EEH: Bridge control: %04x\n", cfg); | 196 | pr_warn("EEH: Bridge control: %04x\n", cfg); |
193 | } | 197 | } |
@@ -195,11 +199,11 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len) | |||
195 | /* Dump out the PCI-X command and status regs */ | 199 | /* Dump out the PCI-X command and status regs */ |
196 | cap = edev->pcix_cap; | 200 | cap = edev->pcix_cap; |
197 | if (cap) { | 201 | if (cap) { |
198 | eeh_ops->read_config(dn, cap, 4, &cfg); | 202 | eeh_ops->read_config(pdn, cap, 4, &cfg); |
199 | n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg); | 203 | n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg); |
200 | pr_warn("EEH: PCI-X cmd: %08x\n", cfg); | 204 | pr_warn("EEH: PCI-X cmd: %08x\n", cfg); |
201 | 205 | ||
202 | eeh_ops->read_config(dn, cap+4, 4, &cfg); | 206 | eeh_ops->read_config(pdn, cap+4, 4, &cfg); |
203 | n += scnprintf(buf+n, len-n, "pcix-stat:%x\n", cfg); | 207 | n += scnprintf(buf+n, len-n, "pcix-stat:%x\n", cfg); |
204 | pr_warn("EEH: PCI-X status: %08x\n", cfg); | 208 | pr_warn("EEH: PCI-X status: %08x\n", cfg); |
205 | } | 209 | } |
@@ -211,7 +215,7 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len) | |||
211 | pr_warn("EEH: PCI-E capabilities and status follow:\n"); | 215 | pr_warn("EEH: PCI-E capabilities and status follow:\n"); |
212 | 216 | ||
213 | for (i=0; i<=8; i++) { | 217 | for (i=0; i<=8; i++) { |
214 | eeh_ops->read_config(dn, cap+4*i, 4, &cfg); | 218 | eeh_ops->read_config(pdn, cap+4*i, 4, &cfg); |
215 | n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); | 219 | n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); |
216 | 220 | ||
217 | if ((i % 4) == 0) { | 221 | if ((i % 4) == 0) { |
@@ -238,7 +242,7 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len) | |||
238 | pr_warn("EEH: PCI-E AER capability register set follows:\n"); | 242 | pr_warn("EEH: PCI-E AER capability register set follows:\n"); |
239 | 243 | ||
240 | for (i=0; i<=13; i++) { | 244 | for (i=0; i<=13; i++) { |
241 | eeh_ops->read_config(dn, cap+4*i, 4, &cfg); | 245 | eeh_ops->read_config(pdn, cap+4*i, 4, &cfg); |
242 | n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); | 246 | n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); |
243 | 247 | ||
244 | if ((i % 4) == 0) { | 248 | if ((i % 4) == 0) { |
@@ -698,7 +702,7 @@ static void *eeh_disable_and_save_dev_state(void *data, void *userdata) | |||
698 | static void *eeh_restore_dev_state(void *data, void *userdata) | 702 | static void *eeh_restore_dev_state(void *data, void *userdata) |
699 | { | 703 | { |
700 | struct eeh_dev *edev = data; | 704 | struct eeh_dev *edev = data; |
701 | struct device_node *dn = eeh_dev_to_of_node(edev); | 705 | struct pci_dn *pdn = eeh_dev_to_pdn(edev); |
702 | struct pci_dev *pdev = eeh_dev_to_pci_dev(edev); | 706 | struct pci_dev *pdev = eeh_dev_to_pci_dev(edev); |
703 | struct pci_dev *dev = userdata; | 707 | struct pci_dev *dev = userdata; |
704 | 708 | ||
@@ -706,8 +710,8 @@ static void *eeh_restore_dev_state(void *data, void *userdata) | |||
706 | return NULL; | 710 | return NULL; |
707 | 711 | ||
708 | /* Apply customization from firmware */ | 712 | /* Apply customization from firmware */ |
709 | if (dn && eeh_ops->restore_config) | 713 | if (pdn && eeh_ops->restore_config) |
710 | eeh_ops->restore_config(dn); | 714 | eeh_ops->restore_config(pdn); |
711 | 715 | ||
712 | /* The caller should restore state for the specified device */ | 716 | /* The caller should restore state for the specified device */ |
713 | if (pdev != dev) | 717 | if (pdev != dev) |
@@ -870,15 +874,15 @@ out: | |||
870 | */ | 874 | */ |
871 | void eeh_save_bars(struct eeh_dev *edev) | 875 | void eeh_save_bars(struct eeh_dev *edev) |
872 | { | 876 | { |
877 | struct pci_dn *pdn; | ||
873 | int i; | 878 | int i; |
874 | struct device_node *dn; | ||
875 | 879 | ||
876 | if (!edev) | 880 | pdn = eeh_dev_to_pdn(edev); |
881 | if (!pdn) | ||
877 | return; | 882 | return; |
878 | dn = eeh_dev_to_of_node(edev); | ||
879 | 883 | ||
880 | for (i = 0; i < 16; i++) | 884 | for (i = 0; i < 16; i++) |
881 | eeh_ops->read_config(dn, i * 4, 4, &edev->config_space[i]); | 885 | eeh_ops->read_config(pdn, i * 4, 4, &edev->config_space[i]); |
882 | 886 | ||
883 | /* | 887 | /* |
884 | * For PCI bridges including root port, we need enable bus | 888 | * For PCI bridges including root port, we need enable bus |
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index 1e4946c36f9e..209cd753bf46 100644 --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c | |||
@@ -291,27 +291,25 @@ struct eeh_pe *eeh_pe_get(struct eeh_dev *edev) | |||
291 | */ | 291 | */ |
292 | static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev) | 292 | static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev) |
293 | { | 293 | { |
294 | struct device_node *dn; | ||
295 | struct eeh_dev *parent; | 294 | struct eeh_dev *parent; |
295 | struct pci_dn *pdn = eeh_dev_to_pdn(edev); | ||
296 | 296 | ||
297 | /* | 297 | /* |
298 | * It might have the case for the indirect parent | 298 | * It might have the case for the indirect parent |
299 | * EEH device already having associated PE, but | 299 | * EEH device already having associated PE, but |
300 | * the direct parent EEH device doesn't have yet. | 300 | * the direct parent EEH device doesn't have yet. |
301 | */ | 301 | */ |
302 | dn = edev->dn->parent; | 302 | pdn = pdn ? pdn->parent : NULL; |
303 | while (dn) { | 303 | while (pdn) { |
304 | /* We're poking out of PCI territory */ | 304 | /* We're poking out of PCI territory */ |
305 | if (!PCI_DN(dn)) return NULL; | 305 | parent = pdn_to_eeh_dev(pdn); |
306 | 306 | if (!parent) | |
307 | parent = of_node_to_eeh_dev(dn); | 307 | return NULL; |
308 | /* We're poking out of PCI territory */ | ||
309 | if (!parent) return NULL; | ||
310 | 308 | ||
311 | if (parent->pe) | 309 | if (parent->pe) |
312 | return parent->pe; | 310 | return parent->pe; |
313 | 311 | ||
314 | dn = dn->parent; | 312 | pdn = pdn->parent; |
315 | } | 313 | } |
316 | 314 | ||
317 | return NULL; | 315 | return NULL; |
@@ -653,9 +651,9 @@ void eeh_pe_state_clear(struct eeh_pe *pe, int state) | |||
653 | * blocked on normal path during the stage. So we need utilize | 651 | * blocked on normal path during the stage. So we need utilize |
654 | * eeh operations, which is always permitted. | 652 | * eeh operations, which is always permitted. |
655 | */ | 653 | */ |
656 | static void eeh_bridge_check_link(struct eeh_dev *edev, | 654 | static void eeh_bridge_check_link(struct eeh_dev *edev) |
657 | struct device_node *dn) | ||
658 | { | 655 | { |
656 | struct pci_dn *pdn = eeh_dev_to_pdn(edev); | ||
659 | int cap; | 657 | int cap; |
660 | uint32_t val; | 658 | uint32_t val; |
661 | int timeout = 0; | 659 | int timeout = 0; |
@@ -675,32 +673,32 @@ static void eeh_bridge_check_link(struct eeh_dev *edev, | |||
675 | 673 | ||
676 | /* Check slot status */ | 674 | /* Check slot status */ |
677 | cap = edev->pcie_cap; | 675 | cap = edev->pcie_cap; |
678 | eeh_ops->read_config(dn, cap + PCI_EXP_SLTSTA, 2, &val); | 676 | eeh_ops->read_config(pdn, cap + PCI_EXP_SLTSTA, 2, &val); |
679 | if (!(val & PCI_EXP_SLTSTA_PDS)) { | 677 | if (!(val & PCI_EXP_SLTSTA_PDS)) { |
680 | pr_debug(" No card in the slot (0x%04x) !\n", val); | 678 | pr_debug(" No card in the slot (0x%04x) !\n", val); |
681 | return; | 679 | return; |
682 | } | 680 | } |
683 | 681 | ||
684 | /* Check power status if we have the capability */ | 682 | /* Check power status if we have the capability */ |
685 | eeh_ops->read_config(dn, cap + PCI_EXP_SLTCAP, 2, &val); | 683 | eeh_ops->read_config(pdn, cap + PCI_EXP_SLTCAP, 2, &val); |
686 | if (val & PCI_EXP_SLTCAP_PCP) { | 684 | if (val & PCI_EXP_SLTCAP_PCP) { |
687 | eeh_ops->read_config(dn, cap + PCI_EXP_SLTCTL, 2, &val); | 685 | eeh_ops->read_config(pdn, cap + PCI_EXP_SLTCTL, 2, &val); |
688 | if (val & PCI_EXP_SLTCTL_PCC) { | 686 | if (val & PCI_EXP_SLTCTL_PCC) { |
689 | pr_debug(" In power-off state, power it on ...\n"); | 687 | pr_debug(" In power-off state, power it on ...\n"); |
690 | val &= ~(PCI_EXP_SLTCTL_PCC | PCI_EXP_SLTCTL_PIC); | 688 | val &= ~(PCI_EXP_SLTCTL_PCC | PCI_EXP_SLTCTL_PIC); |
691 | val |= (0x0100 & PCI_EXP_SLTCTL_PIC); | 689 | val |= (0x0100 & PCI_EXP_SLTCTL_PIC); |
692 | eeh_ops->write_config(dn, cap + PCI_EXP_SLTCTL, 2, val); | 690 | eeh_ops->write_config(pdn, cap + PCI_EXP_SLTCTL, 2, val); |
693 | msleep(2 * 1000); | 691 | msleep(2 * 1000); |
694 | } | 692 | } |
695 | } | 693 | } |
696 | 694 | ||
697 | /* Enable link */ | 695 | /* Enable link */ |
698 | eeh_ops->read_config(dn, cap + PCI_EXP_LNKCTL, 2, &val); | 696 | eeh_ops->read_config(pdn, cap + PCI_EXP_LNKCTL, 2, &val); |
699 | val &= ~PCI_EXP_LNKCTL_LD; | 697 | val &= ~PCI_EXP_LNKCTL_LD; |
700 | eeh_ops->write_config(dn, cap + PCI_EXP_LNKCTL, 2, val); | 698 | eeh_ops->write_config(pdn, cap + PCI_EXP_LNKCTL, 2, val); |
701 | 699 | ||
702 | /* Check link */ | 700 | /* Check link */ |
703 | eeh_ops->read_config(dn, cap + PCI_EXP_LNKCAP, 4, &val); | 701 | eeh_ops->read_config(pdn, cap + PCI_EXP_LNKCAP, 4, &val); |
704 | if (!(val & PCI_EXP_LNKCAP_DLLLARC)) { | 702 | if (!(val & PCI_EXP_LNKCAP_DLLLARC)) { |
705 | pr_debug(" No link reporting capability (0x%08x) \n", val); | 703 | pr_debug(" No link reporting capability (0x%08x) \n", val); |
706 | msleep(1000); | 704 | msleep(1000); |
@@ -713,7 +711,7 @@ static void eeh_bridge_check_link(struct eeh_dev *edev, | |||
713 | msleep(20); | 711 | msleep(20); |
714 | timeout += 20; | 712 | timeout += 20; |
715 | 713 | ||
716 | eeh_ops->read_config(dn, cap + PCI_EXP_LNKSTA, 2, &val); | 714 | eeh_ops->read_config(pdn, cap + PCI_EXP_LNKSTA, 2, &val); |
717 | if (val & PCI_EXP_LNKSTA_DLLLA) | 715 | if (val & PCI_EXP_LNKSTA_DLLLA) |
718 | break; | 716 | break; |
719 | } | 717 | } |
@@ -728,9 +726,9 @@ static void eeh_bridge_check_link(struct eeh_dev *edev, | |||
728 | #define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF)) | 726 | #define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF)) |
729 | #define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)]) | 727 | #define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)]) |
730 | 728 | ||
731 | static void eeh_restore_bridge_bars(struct eeh_dev *edev, | 729 | static void eeh_restore_bridge_bars(struct eeh_dev *edev) |
732 | struct device_node *dn) | ||
733 | { | 730 | { |
731 | struct pci_dn *pdn = eeh_dev_to_pdn(edev); | ||
734 | int i; | 732 | int i; |
735 | 733 | ||
736 | /* | 734 | /* |
@@ -738,49 +736,49 @@ static void eeh_restore_bridge_bars(struct eeh_dev *edev, | |||
738 | * Bus numbers and windows: 0x18 - 0x30 | 736 | * Bus numbers and windows: 0x18 - 0x30 |
739 | */ | 737 | */ |
740 | for (i = 4; i < 13; i++) | 738 | for (i = 4; i < 13; i++) |
741 | eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]); | 739 | eeh_ops->write_config(pdn, i*4, 4, edev->config_space[i]); |
742 | /* Rom: 0x38 */ | 740 | /* Rom: 0x38 */ |
743 | eeh_ops->write_config(dn, 14*4, 4, edev->config_space[14]); | 741 | eeh_ops->write_config(pdn, 14*4, 4, edev->config_space[14]); |
744 | 742 | ||
745 | /* Cache line & Latency timer: 0xC 0xD */ | 743 | /* Cache line & Latency timer: 0xC 0xD */ |
746 | eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1, | 744 | eeh_ops->write_config(pdn, PCI_CACHE_LINE_SIZE, 1, |
747 | SAVED_BYTE(PCI_CACHE_LINE_SIZE)); | 745 | SAVED_BYTE(PCI_CACHE_LINE_SIZE)); |
748 | eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1, | 746 | eeh_ops->write_config(pdn, PCI_LATENCY_TIMER, 1, |
749 | SAVED_BYTE(PCI_LATENCY_TIMER)); | 747 | SAVED_BYTE(PCI_LATENCY_TIMER)); |
750 | /* Max latency, min grant, interrupt ping and line: 0x3C */ | 748 | /* Max latency, min grant, interrupt ping and line: 0x3C */ |
751 | eeh_ops->write_config(dn, 15*4, 4, edev->config_space[15]); | 749 | eeh_ops->write_config(pdn, 15*4, 4, edev->config_space[15]); |
752 | 750 | ||
753 | /* PCI Command: 0x4 */ | 751 | /* PCI Command: 0x4 */ |
754 | eeh_ops->write_config(dn, PCI_COMMAND, 4, edev->config_space[1]); | 752 | eeh_ops->write_config(pdn, PCI_COMMAND, 4, edev->config_space[1]); |
755 | 753 | ||
756 | /* Check the PCIe link is ready */ | 754 | /* Check the PCIe link is ready */ |
757 | eeh_bridge_check_link(edev, dn); | 755 | eeh_bridge_check_link(edev); |
758 | } | 756 | } |
759 | 757 | ||
760 | static void eeh_restore_device_bars(struct eeh_dev *edev, | 758 | static void eeh_restore_device_bars(struct eeh_dev *edev) |
761 | struct device_node *dn) | ||
762 | { | 759 | { |
760 | struct pci_dn *pdn = eeh_dev_to_pdn(edev); | ||
763 | int i; | 761 | int i; |
764 | u32 cmd; | 762 | u32 cmd; |
765 | 763 | ||
766 | for (i = 4; i < 10; i++) | 764 | for (i = 4; i < 10; i++) |
767 | eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]); | 765 | eeh_ops->write_config(pdn, i*4, 4, edev->config_space[i]); |
768 | /* 12 == Expansion ROM Address */ | 766 | /* 12 == Expansion ROM Address */ |
769 | eeh_ops->write_config(dn, 12*4, 4, edev->config_space[12]); | 767 | eeh_ops->write_config(pdn, 12*4, 4, edev->config_space[12]); |
770 | 768 | ||
771 | eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1, | 769 | eeh_ops->write_config(pdn, PCI_CACHE_LINE_SIZE, 1, |
772 | SAVED_BYTE(PCI_CACHE_LINE_SIZE)); | 770 | SAVED_BYTE(PCI_CACHE_LINE_SIZE)); |
773 | eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1, | 771 | eeh_ops->write_config(pdn, PCI_LATENCY_TIMER, 1, |
774 | SAVED_BYTE(PCI_LATENCY_TIMER)); | 772 | SAVED_BYTE(PCI_LATENCY_TIMER)); |
775 | 773 | ||
776 | /* max latency, min grant, interrupt pin and line */ | 774 | /* max latency, min grant, interrupt pin and line */ |
777 | eeh_ops->write_config(dn, 15*4, 4, edev->config_space[15]); | 775 | eeh_ops->write_config(pdn, 15*4, 4, edev->config_space[15]); |
778 | 776 | ||
779 | /* | 777 | /* |
780 | * Restore PERR & SERR bits, some devices require it, | 778 | * Restore PERR & SERR bits, some devices require it, |
781 | * don't touch the other command bits | 779 | * don't touch the other command bits |
782 | */ | 780 | */ |
783 | eeh_ops->read_config(dn, PCI_COMMAND, 4, &cmd); | 781 | eeh_ops->read_config(pdn, PCI_COMMAND, 4, &cmd); |
784 | if (edev->config_space[1] & PCI_COMMAND_PARITY) | 782 | if (edev->config_space[1] & PCI_COMMAND_PARITY) |
785 | cmd |= PCI_COMMAND_PARITY; | 783 | cmd |= PCI_COMMAND_PARITY; |
786 | else | 784 | else |
@@ -789,7 +787,7 @@ static void eeh_restore_device_bars(struct eeh_dev *edev, | |||
789 | cmd |= PCI_COMMAND_SERR; | 787 | cmd |= PCI_COMMAND_SERR; |
790 | else | 788 | else |
791 | cmd &= ~PCI_COMMAND_SERR; | 789 | cmd &= ~PCI_COMMAND_SERR; |
792 | eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd); | 790 | eeh_ops->write_config(pdn, PCI_COMMAND, 4, cmd); |
793 | } | 791 | } |
794 | 792 | ||
795 | /** | 793 | /** |
@@ -804,16 +802,16 @@ static void eeh_restore_device_bars(struct eeh_dev *edev, | |||
804 | static void *eeh_restore_one_device_bars(void *data, void *flag) | 802 | static void *eeh_restore_one_device_bars(void *data, void *flag) |
805 | { | 803 | { |
806 | struct eeh_dev *edev = (struct eeh_dev *)data; | 804 | struct eeh_dev *edev = (struct eeh_dev *)data; |
807 | struct device_node *dn = eeh_dev_to_of_node(edev); | 805 | struct pci_dn *pdn = eeh_dev_to_pdn(edev); |
808 | 806 | ||
809 | /* Do special restore for bridges */ | 807 | /* Do special restore for bridges */ |
810 | if (edev->mode & EEH_DEV_BRIDGE) | 808 | if (edev->mode & EEH_DEV_BRIDGE) |
811 | eeh_restore_bridge_bars(edev, dn); | 809 | eeh_restore_bridge_bars(edev); |
812 | else | 810 | else |
813 | eeh_restore_device_bars(edev, dn); | 811 | eeh_restore_device_bars(edev); |
814 | 812 | ||
815 | if (eeh_ops->restore_config) | 813 | if (eeh_ops->restore_config && pdn) |
816 | eeh_ops->restore_config(dn); | 814 | eeh_ops->restore_config(pdn); |
817 | 815 | ||
818 | return NULL; | 816 | return NULL; |
819 | } | 817 | } |