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