1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <linux/atomic.h>
16#include <linux/delay.h>
17#include <linux/export.h>
18#include <linux/init.h>
19#include <linux/list.h>
20#include <linux/of.h>
21#include <linux/pci.h>
22#include <linux/proc_fs.h>
23#include <linux/rbtree.h>
24#include <linux/sched.h>
25#include <linux/seq_file.h>
26#include <linux/spinlock.h>
27#include <linux/crash_dump.h>
28
29#include <asm/eeh.h>
30#include <asm/eeh_event.h>
31#include <asm/io.h>
32#include <asm/machdep.h>
33#include <asm/ppc-pci.h>
34#include <asm/rtas.h>
35
36
37static int ibm_set_eeh_option;
38static int ibm_set_slot_reset;
39static int ibm_read_slot_reset_state;
40static int ibm_read_slot_reset_state2;
41static int ibm_slot_error_detail;
42static int ibm_get_config_addr_info;
43static int ibm_get_config_addr_info2;
44static int ibm_configure_pe;
45
46void pseries_pcibios_bus_add_device(struct pci_dev *pdev)
47{
48 struct pci_dn *pdn = pci_get_pdn(pdev);
49
50 if (eeh_has_flag(EEH_FORCE_DISABLED))
51 return;
52
53 dev_dbg(&pdev->dev, "EEH: Setting up device\n");
54#ifdef CONFIG_PCI_IOV
55 if (pdev->is_virtfn) {
56 pdn->device_id = pdev->device;
57 pdn->vendor_id = pdev->vendor;
58 pdn->class_code = pdev->class;
59
60
61
62
63
64 pdn->last_allow_rc = 0;
65 }
66#endif
67 pseries_eeh_init_edev(pdn);
68#ifdef CONFIG_PCI_IOV
69 if (pdev->is_virtfn) {
70
71
72
73
74 struct eeh_pe *physfn_pe = pci_dev_to_eeh_dev(pdev->physfn)->pe;
75 struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
76
77 edev->pe_config_addr = (pdn->busno << 16) | (pdn->devfn << 8);
78 eeh_pe_tree_remove(edev);
79 eeh_pe_tree_insert(edev, physfn_pe);
80 }
81#endif
82 eeh_probe_device(pdev);
83}
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99static int pseries_eeh_get_pe_config_addr(struct pci_dn *pdn)
100{
101 int config_addr = rtas_config_addr(pdn->busno, pdn->devfn, 0);
102 struct pci_controller *phb = pdn->phb;
103 int ret, rets[3];
104
105 if (ibm_get_config_addr_info2 != RTAS_UNKNOWN_SERVICE) {
106
107
108
109
110 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets,
111 config_addr, BUID_HI(phb->buid),
112 BUID_LO(phb->buid), 1);
113 if (ret || (rets[0] == 0))
114 return -ENOENT;
115
116
117 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets,
118 config_addr, BUID_HI(phb->buid),
119 BUID_LO(phb->buid), 0);
120 if (ret) {
121 pr_warn("%s: Failed to get address for PHB#%x-PE#%x\n",
122 __func__, phb->global_number, config_addr);
123 return -ENXIO;
124 }
125
126 return rets[0];
127 }
128
129 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) {
130 ret = rtas_call(ibm_get_config_addr_info, 4, 2, rets,
131 config_addr, BUID_HI(phb->buid),
132 BUID_LO(phb->buid), 0);
133 if (ret) {
134 pr_warn("%s: Failed to get address for PHB#%x-PE#%x\n",
135 __func__, phb->global_number, config_addr);
136 return -ENXIO;
137 }
138
139 return rets[0];
140 }
141
142
143
144
145
146
147
148
149 return -ENOENT;
150}
151
152
153
154
155
156
157
158
159
160static int pseries_eeh_phb_reset(struct pci_controller *phb, int config_addr, int option)
161{
162 int ret;
163
164
165 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL,
166 config_addr, BUID_HI(phb->buid),
167 BUID_LO(phb->buid), option);
168
169
170 if (option == EEH_RESET_FUNDAMENTAL && ret == -8) {
171 option = EEH_RESET_HOT;
172 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL,
173 config_addr, BUID_HI(phb->buid),
174 BUID_LO(phb->buid), option);
175 }
176
177
178 if (option == EEH_RESET_FUNDAMENTAL || option == EEH_RESET_HOT)
179 msleep(EEH_PE_RST_HOLD_TIME);
180 else
181 msleep(EEH_PE_RST_SETTLE_TIME);
182
183 return ret;
184}
185
186
187
188
189
190
191
192
193
194
195static int pseries_eeh_phb_configure_bridge(struct pci_controller *phb, int config_addr)
196{
197 int ret;
198
199 int max_wait = 200;
200
201 while (max_wait > 0) {
202 ret = rtas_call(ibm_configure_pe, 3, 1, NULL,
203 config_addr, BUID_HI(phb->buid),
204 BUID_LO(phb->buid));
205
206 if (!ret)
207 return ret;
208 if (ret < 0)
209 break;
210
211
212
213
214
215
216 if (ret > RTAS_EXTENDED_DELAY_MIN+2 &&
217 ret <= RTAS_EXTENDED_DELAY_MAX)
218 ret = RTAS_EXTENDED_DELAY_MIN+2;
219
220 max_wait -= rtas_busy_delay_time(ret);
221
222 if (max_wait < 0)
223 break;
224
225 rtas_busy_delay(ret);
226 }
227
228 pr_warn("%s: Unable to configure bridge PHB#%x-PE#%x (%d)\n",
229 __func__, phb->global_number, config_addr, ret);
230
231 if (ret == -3)
232 return -EINVAL;
233 else
234 return -EIO;
235}
236
237
238
239
240
241
242static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX];
243static DEFINE_SPINLOCK(slot_errbuf_lock);
244static int eeh_error_buf_size;
245
246static int pseries_eeh_cap_start(struct pci_dn *pdn)
247{
248 u32 status;
249
250 if (!pdn)
251 return 0;
252
253 rtas_read_config(pdn, PCI_STATUS, 2, &status);
254 if (!(status & PCI_STATUS_CAP_LIST))
255 return 0;
256
257 return PCI_CAPABILITY_LIST;
258}
259
260
261static int pseries_eeh_find_cap(struct pci_dn *pdn, int cap)
262{
263 int pos = pseries_eeh_cap_start(pdn);
264 int cnt = 48;
265 u32 id;
266
267 if (!pos)
268 return 0;
269
270 while (cnt--) {
271 rtas_read_config(pdn, pos, 1, &pos);
272 if (pos < 0x40)
273 break;
274 pos &= ~3;
275 rtas_read_config(pdn, pos + PCI_CAP_LIST_ID, 1, &id);
276 if (id == 0xff)
277 break;
278 if (id == cap)
279 return pos;
280 pos += PCI_CAP_LIST_NEXT;
281 }
282
283 return 0;
284}
285
286static int pseries_eeh_find_ecap(struct pci_dn *pdn, int cap)
287{
288 struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
289 u32 header;
290 int pos = 256;
291 int ttl = (4096 - 256) / 8;
292
293 if (!edev || !edev->pcie_cap)
294 return 0;
295 if (rtas_read_config(pdn, pos, 4, &header) != PCIBIOS_SUCCESSFUL)
296 return 0;
297 else if (!header)
298 return 0;
299
300 while (ttl-- > 0) {
301 if (PCI_EXT_CAP_ID(header) == cap && pos)
302 return pos;
303
304 pos = PCI_EXT_CAP_NEXT(header);
305 if (pos < 256)
306 break;
307
308 if (rtas_read_config(pdn, pos, 4, &header) != PCIBIOS_SUCCESSFUL)
309 break;
310 }
311
312 return 0;
313}
314
315
316
317
318
319
320
321
322
323static struct eeh_pe *pseries_eeh_pe_get_parent(struct eeh_dev *edev)
324{
325 struct eeh_dev *parent;
326 struct pci_dn *pdn = eeh_dev_to_pdn(edev);
327
328
329
330
331
332
333 if (edev->physfn)
334 pdn = pci_get_pdn(edev->physfn);
335 else
336 pdn = pdn ? pdn->parent : NULL;
337 while (pdn) {
338
339 parent = pdn_to_eeh_dev(pdn);
340 if (!parent)
341 return NULL;
342
343 if (parent->pe)
344 return parent->pe;
345
346 pdn = pdn->parent;
347 }
348
349 return NULL;
350}
351
352
353
354
355
356
357
358
359
360
361
362void pseries_eeh_init_edev(struct pci_dn *pdn)
363{
364 struct eeh_pe pe, *parent;
365 struct eeh_dev *edev;
366 u32 pcie_flags;
367 int ret;
368
369 if (WARN_ON_ONCE(!eeh_has_flag(EEH_PROBE_MODE_DEVTREE)))
370 return;
371
372
373
374
375
376
377
378 edev = pdn_to_eeh_dev(pdn);
379 if (!edev)
380 return;
381
382
383
384
385
386
387
388 if (edev->pe)
389 return;
390
391
392 if (!pdn->vendor_id || !pdn->device_id || !pdn->class_code)
393 return;
394
395
396 if ((pdn->class_code >> 8) == PCI_CLASS_BRIDGE_ISA)
397 return;
398
399 eeh_edev_dbg(edev, "Probing device\n");
400
401
402
403
404
405
406 edev->pcix_cap = pseries_eeh_find_cap(pdn, PCI_CAP_ID_PCIX);
407 edev->pcie_cap = pseries_eeh_find_cap(pdn, PCI_CAP_ID_EXP);
408 edev->aer_cap = pseries_eeh_find_ecap(pdn, PCI_EXT_CAP_ID_ERR);
409 edev->mode &= 0xFFFFFF00;
410 if ((pdn->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) {
411 edev->mode |= EEH_DEV_BRIDGE;
412 if (edev->pcie_cap) {
413 rtas_read_config(pdn, edev->pcie_cap + PCI_EXP_FLAGS,
414 2, &pcie_flags);
415 pcie_flags = (pcie_flags & PCI_EXP_FLAGS_TYPE) >> 4;
416 if (pcie_flags == PCI_EXP_TYPE_ROOT_PORT)
417 edev->mode |= EEH_DEV_ROOT_PORT;
418 else if (pcie_flags == PCI_EXP_TYPE_DOWNSTREAM)
419 edev->mode |= EEH_DEV_DS_PORT;
420 }
421 }
422
423
424 ret = pseries_eeh_get_pe_config_addr(pdn);
425 if (ret < 0) {
426 eeh_edev_dbg(edev, "Unable to find pe_config_addr\n");
427 goto err;
428 }
429
430
431 memset(&pe, 0, sizeof(struct eeh_pe));
432 pe.phb = pdn->phb;
433 pe.addr = ret;
434
435 eeh_edev_dbg(edev, "Enabling EEH on device\n");
436 ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
437 if (ret) {
438 eeh_edev_dbg(edev, "EEH failed to enable on device (code %d)\n", ret);
439 goto err;
440 }
441
442 edev->pe_config_addr = pe.addr;
443
444 eeh_add_flag(EEH_ENABLED);
445
446 parent = pseries_eeh_pe_get_parent(edev);
447 eeh_pe_tree_insert(edev, parent);
448 eeh_save_bars(edev);
449 eeh_edev_dbg(edev, "EEH enabled for device");
450
451 return;
452
453err:
454 eeh_edev_dbg(edev, "EEH is unsupported on device (code = %d)\n", ret);
455}
456
457static struct eeh_dev *pseries_eeh_probe(struct pci_dev *pdev)
458{
459 struct eeh_dev *edev;
460 struct pci_dn *pdn;
461
462 pdn = pci_get_pdn_by_devfn(pdev->bus, pdev->devfn);
463 if (!pdn)
464 return NULL;
465
466
467
468
469
470 edev = pdn_to_eeh_dev(pdn);
471 if (!edev || !edev->pe)
472 return NULL;
473
474 return edev;
475}
476
477
478
479
480
481
482
483
484
485void pseries_eeh_init_edev_recursive(struct pci_dn *pdn)
486{
487 struct pci_dn *n;
488
489 if (!pdn)
490 return;
491
492 list_for_each_entry(n, &pdn->child_list, list)
493 pseries_eeh_init_edev_recursive(n);
494
495 pseries_eeh_init_edev(pdn);
496}
497EXPORT_SYMBOL_GPL(pseries_eeh_init_edev_recursive);
498
499
500
501
502
503
504
505
506
507
508static int pseries_eeh_set_option(struct eeh_pe *pe, int option)
509{
510 int ret = 0;
511
512
513
514
515
516
517
518 switch (option) {
519 case EEH_OPT_DISABLE:
520 case EEH_OPT_ENABLE:
521 case EEH_OPT_THAW_MMIO:
522 case EEH_OPT_THAW_DMA:
523 break;
524 case EEH_OPT_FREEZE_PE:
525
526 return 0;
527 default:
528 pr_err("%s: Invalid option %d\n", __func__, option);
529 return -EINVAL;
530 }
531
532 ret = rtas_call(ibm_set_eeh_option, 4, 1, NULL,
533 pe->addr, BUID_HI(pe->phb->buid),
534 BUID_LO(pe->phb->buid), option);
535
536 return ret;
537}
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552static int pseries_eeh_get_state(struct eeh_pe *pe, int *delay)
553{
554 int ret;
555 int rets[4];
556 int result;
557
558 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
559 ret = rtas_call(ibm_read_slot_reset_state2, 3, 4, rets,
560 pe->addr, BUID_HI(pe->phb->buid),
561 BUID_LO(pe->phb->buid));
562 } else if (ibm_read_slot_reset_state != RTAS_UNKNOWN_SERVICE) {
563
564 rets[2] = 0;
565 ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets,
566 pe->addr, BUID_HI(pe->phb->buid),
567 BUID_LO(pe->phb->buid));
568 } else {
569 return EEH_STATE_NOT_SUPPORT;
570 }
571
572 if (ret)
573 return ret;
574
575
576 if (!rets[1])
577 return EEH_STATE_NOT_SUPPORT;
578
579 switch(rets[0]) {
580 case 0:
581 result = EEH_STATE_MMIO_ACTIVE |
582 EEH_STATE_DMA_ACTIVE;
583 break;
584 case 1:
585 result = EEH_STATE_RESET_ACTIVE |
586 EEH_STATE_MMIO_ACTIVE |
587 EEH_STATE_DMA_ACTIVE;
588 break;
589 case 2:
590 result = 0;
591 break;
592 case 4:
593 result = EEH_STATE_MMIO_ENABLED;
594 break;
595 case 5:
596 if (rets[2]) {
597 if (delay)
598 *delay = rets[2];
599 result = EEH_STATE_UNAVAILABLE;
600 } else {
601 result = EEH_STATE_NOT_SUPPORT;
602 }
603 break;
604 default:
605 result = EEH_STATE_NOT_SUPPORT;
606 }
607
608 return result;
609}
610
611
612
613
614
615
616
617
618static int pseries_eeh_reset(struct eeh_pe *pe, int option)
619{
620 return pseries_eeh_phb_reset(pe->phb, pe->addr, option);
621}
622
623
624
625
626
627
628
629
630
631
632
633
634static int pseries_eeh_get_log(struct eeh_pe *pe, int severity, char *drv_log, unsigned long len)
635{
636 unsigned long flags;
637 int ret;
638
639 spin_lock_irqsave(&slot_errbuf_lock, flags);
640 memset(slot_errbuf, 0, eeh_error_buf_size);
641
642 ret = rtas_call(ibm_slot_error_detail, 8, 1, NULL, pe->addr,
643 BUID_HI(pe->phb->buid), BUID_LO(pe->phb->buid),
644 virt_to_phys(drv_log), len,
645 virt_to_phys(slot_errbuf), eeh_error_buf_size,
646 severity);
647 if (!ret)
648 log_error(slot_errbuf, ERR_TYPE_RTAS_LOG, 0);
649 spin_unlock_irqrestore(&slot_errbuf_lock, flags);
650
651 return ret;
652}
653
654
655
656
657
658
659static int pseries_eeh_configure_bridge(struct eeh_pe *pe)
660{
661 return pseries_eeh_phb_configure_bridge(pe->phb, pe->addr);
662}
663
664
665
666
667
668
669
670
671
672
673static int pseries_eeh_read_config(struct eeh_dev *edev, int where, int size, u32 *val)
674{
675 struct pci_dn *pdn = eeh_dev_to_pdn(edev);
676
677 return rtas_read_config(pdn, where, size, val);
678}
679
680
681
682
683
684
685
686
687
688
689static int pseries_eeh_write_config(struct eeh_dev *edev, int where, int size, u32 val)
690{
691 struct pci_dn *pdn = eeh_dev_to_pdn(edev);
692
693 return rtas_write_config(pdn, where, size, val);
694}
695
696#ifdef CONFIG_PCI_IOV
697int pseries_send_allow_unfreeze(struct pci_dn *pdn,
698 u16 *vf_pe_array, int cur_vfs)
699{
700 int rc;
701 int ibm_allow_unfreeze = rtas_token("ibm,open-sriov-allow-unfreeze");
702 unsigned long buid, addr;
703
704 addr = rtas_config_addr(pdn->busno, pdn->devfn, 0);
705 buid = pdn->phb->buid;
706 spin_lock(&rtas_data_buf_lock);
707 memcpy(rtas_data_buf, vf_pe_array, RTAS_DATA_BUF_SIZE);
708 rc = rtas_call(ibm_allow_unfreeze, 5, 1, NULL,
709 addr,
710 BUID_HI(buid),
711 BUID_LO(buid),
712 rtas_data_buf, cur_vfs * sizeof(u16));
713 spin_unlock(&rtas_data_buf_lock);
714 if (rc)
715 pr_warn("%s: Failed to allow unfreeze for PHB#%x-PE#%lx, rc=%x\n",
716 __func__,
717 pdn->phb->global_number, addr, rc);
718 return rc;
719}
720
721static int pseries_call_allow_unfreeze(struct eeh_dev *edev)
722{
723 int cur_vfs = 0, rc = 0, vf_index, bus, devfn, vf_pe_num;
724 struct pci_dn *pdn, *tmp, *parent, *physfn_pdn;
725 u16 *vf_pe_array;
726
727 vf_pe_array = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
728 if (!vf_pe_array)
729 return -ENOMEM;
730 if (pci_num_vf(edev->physfn ? edev->physfn : edev->pdev)) {
731 if (edev->pdev->is_physfn) {
732 cur_vfs = pci_num_vf(edev->pdev);
733 pdn = eeh_dev_to_pdn(edev);
734 parent = pdn->parent;
735 for (vf_index = 0; vf_index < cur_vfs; vf_index++)
736 vf_pe_array[vf_index] =
737 cpu_to_be16(pdn->pe_num_map[vf_index]);
738 rc = pseries_send_allow_unfreeze(pdn, vf_pe_array,
739 cur_vfs);
740 pdn->last_allow_rc = rc;
741 for (vf_index = 0; vf_index < cur_vfs; vf_index++) {
742 list_for_each_entry_safe(pdn, tmp,
743 &parent->child_list,
744 list) {
745 bus = pci_iov_virtfn_bus(edev->pdev,
746 vf_index);
747 devfn = pci_iov_virtfn_devfn(edev->pdev,
748 vf_index);
749 if (pdn->busno != bus ||
750 pdn->devfn != devfn)
751 continue;
752 pdn->last_allow_rc = rc;
753 }
754 }
755 } else {
756 pdn = pci_get_pdn(edev->pdev);
757 physfn_pdn = pci_get_pdn(edev->physfn);
758
759 vf_pe_num = physfn_pdn->pe_num_map[edev->vf_index];
760 vf_pe_array[0] = cpu_to_be16(vf_pe_num);
761 rc = pseries_send_allow_unfreeze(physfn_pdn,
762 vf_pe_array, 1);
763 pdn->last_allow_rc = rc;
764 }
765 }
766
767 kfree(vf_pe_array);
768 return rc;
769}
770
771static int pseries_notify_resume(struct eeh_dev *edev)
772{
773 if (!edev)
774 return -EEXIST;
775
776 if (rtas_token("ibm,open-sriov-allow-unfreeze") == RTAS_UNKNOWN_SERVICE)
777 return -EINVAL;
778
779 if (edev->pdev->is_physfn || edev->pdev->is_virtfn)
780 return pseries_call_allow_unfreeze(edev);
781
782 return 0;
783}
784#endif
785
786static struct eeh_ops pseries_eeh_ops = {
787 .name = "pseries",
788 .probe = pseries_eeh_probe,
789 .set_option = pseries_eeh_set_option,
790 .get_state = pseries_eeh_get_state,
791 .reset = pseries_eeh_reset,
792 .get_log = pseries_eeh_get_log,
793 .configure_bridge = pseries_eeh_configure_bridge,
794 .err_inject = NULL,
795 .read_config = pseries_eeh_read_config,
796 .write_config = pseries_eeh_write_config,
797 .next_error = NULL,
798 .restore_config = NULL,
799#ifdef CONFIG_PCI_IOV
800 .notify_resume = pseries_notify_resume
801#endif
802};
803
804
805
806
807
808
809
810static int __init eeh_pseries_init(void)
811{
812 struct pci_controller *phb;
813 struct pci_dn *pdn;
814 int ret, config_addr;
815
816
817 ibm_set_eeh_option = rtas_token("ibm,set-eeh-option");
818 ibm_set_slot_reset = rtas_token("ibm,set-slot-reset");
819 ibm_read_slot_reset_state2 = rtas_token("ibm,read-slot-reset-state2");
820 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state");
821 ibm_slot_error_detail = rtas_token("ibm,slot-error-detail");
822 ibm_get_config_addr_info2 = rtas_token("ibm,get-config-addr-info2");
823 ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info");
824 ibm_configure_pe = rtas_token("ibm,configure-pe");
825
826
827
828
829
830
831 if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE)
832 ibm_configure_pe = rtas_token("ibm,configure-bridge");
833
834
835
836
837
838
839 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE ||
840 ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE ||
841 (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE &&
842 ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) ||
843 ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE ||
844 ibm_configure_pe == RTAS_UNKNOWN_SERVICE) {
845 pr_info("EEH functionality not supported\n");
846 return -EINVAL;
847 }
848
849
850 spin_lock_init(&slot_errbuf_lock);
851 eeh_error_buf_size = rtas_token("rtas-error-log-max");
852 if (eeh_error_buf_size == RTAS_UNKNOWN_SERVICE) {
853 pr_info("%s: unknown EEH error log size\n",
854 __func__);
855 eeh_error_buf_size = 1024;
856 } else if (eeh_error_buf_size > RTAS_ERROR_LOG_MAX) {
857 pr_info("%s: EEH error log size %d exceeds the maximal %d\n",
858 __func__, eeh_error_buf_size, RTAS_ERROR_LOG_MAX);
859 eeh_error_buf_size = RTAS_ERROR_LOG_MAX;
860 }
861
862
863 eeh_add_flag(EEH_PROBE_MODE_DEVTREE | EEH_ENABLE_IO_FOR_LOG);
864
865
866 ppc_md.pcibios_bus_add_device = pseries_pcibios_bus_add_device;
867
868 if (is_kdump_kernel() || reset_devices) {
869 pr_info("Issue PHB reset ...\n");
870 list_for_each_entry(phb, &hose_list, list_node) {
871 pdn = list_first_entry(&PCI_DN(phb->dn)->child_list, struct pci_dn, list);
872 config_addr = pseries_eeh_get_pe_config_addr(pdn);
873
874
875 if (config_addr < 0)
876 continue;
877
878 pseries_eeh_phb_reset(phb, config_addr, EEH_RESET_FUNDAMENTAL);
879 pseries_eeh_phb_reset(phb, config_addr, EEH_RESET_DEACTIVATE);
880 pseries_eeh_phb_configure_bridge(phb, config_addr);
881 }
882 }
883
884 ret = eeh_init(&pseries_eeh_ops);
885 if (!ret)
886 pr_info("EEH: pSeries platform initialized\n");
887 else
888 pr_info("EEH: pSeries platform initialization failure (%d)\n",
889 ret);
890 return ret;
891}
892machine_arch_initcall(pseries, eeh_pseries_init);
893