Commit e9cc17d4 authored by Gavin Shan's avatar Gavin Shan Committed by Benjamin Herrenschmidt

powerpc/eeh: Initialization for PowerNV

The patch initializes EEH for PowerNV platform. Because the OPAL
APIs requires HUB ID, we need trace that through struct pnv_phb.
Signed-off-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 29310e5e
...@@ -974,6 +974,11 @@ static void pnv_pci_ioda_fixup(void) ...@@ -974,6 +974,11 @@ static void pnv_pci_ioda_fixup(void)
pnv_pci_ioda_setup_PEs(); pnv_pci_ioda_setup_PEs();
pnv_pci_ioda_setup_seg(); pnv_pci_ioda_setup_seg();
pnv_pci_ioda_setup_DMA(); pnv_pci_ioda_setup_DMA();
#ifdef CONFIG_EEH
eeh_addr_cache_build();
eeh_init();
#endif
} }
/* /*
...@@ -1050,7 +1055,8 @@ static void pnv_pci_ioda_shutdown(struct pnv_phb *phb) ...@@ -1050,7 +1055,8 @@ static void pnv_pci_ioda_shutdown(struct pnv_phb *phb)
OPAL_ASSERT_RESET); OPAL_ASSERT_RESET);
} }
void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type) void __init pnv_pci_init_ioda_phb(struct device_node *np,
u64 hub_id, int ioda_type)
{ {
struct pci_controller *hose; struct pci_controller *hose;
static int primary = 1; static int primary = 1;
...@@ -1088,6 +1094,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type) ...@@ -1088,6 +1094,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
hose->first_busno = 0; hose->first_busno = 0;
hose->last_busno = 0xff; hose->last_busno = 0xff;
hose->private_data = phb; hose->private_data = phb;
phb->hub_id = hub_id;
phb->opal_id = phb_id; phb->opal_id = phb_id;
phb->type = ioda_type; phb->type = ioda_type;
...@@ -1173,6 +1180,9 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type) ...@@ -1173,6 +1180,9 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
phb->ioda.io_size, phb->ioda.io_segsize); phb->ioda.io_size, phb->ioda.io_segsize);
phb->hose->ops = &pnv_pci_ops; phb->hose->ops = &pnv_pci_ops;
#ifdef CONFIG_EEH
phb->eeh_ops = &ioda_eeh_ops;
#endif
/* Setup RID -> PE mapping function */ /* Setup RID -> PE mapping function */
phb->bdfn_to_pe = pnv_ioda_bdfn_to_pe; phb->bdfn_to_pe = pnv_ioda_bdfn_to_pe;
...@@ -1213,7 +1223,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type) ...@@ -1213,7 +1223,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
void pnv_pci_init_ioda2_phb(struct device_node *np) void pnv_pci_init_ioda2_phb(struct device_node *np)
{ {
pnv_pci_init_ioda_phb(np, PNV_PHB_IODA2); pnv_pci_init_ioda_phb(np, 0, PNV_PHB_IODA2);
} }
void __init pnv_pci_init_ioda_hub(struct device_node *np) void __init pnv_pci_init_ioda_hub(struct device_node *np)
...@@ -1236,6 +1246,6 @@ void __init pnv_pci_init_ioda_hub(struct device_node *np) ...@@ -1236,6 +1246,6 @@ void __init pnv_pci_init_ioda_hub(struct device_node *np)
for_each_child_of_node(np, phbn) { for_each_child_of_node(np, phbn) {
/* Look for IODA1 PHBs */ /* Look for IODA1 PHBs */
if (of_device_is_compatible(phbn, "ibm,ioda-phb")) if (of_device_is_compatible(phbn, "ibm,ioda-phb"))
pnv_pci_init_ioda_phb(phbn, PNV_PHB_IODA1); pnv_pci_init_ioda_phb(phbn, hub_id, PNV_PHB_IODA1);
} }
} }
...@@ -95,7 +95,7 @@ static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb *phb, ...@@ -95,7 +95,7 @@ static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb *phb,
set_iommu_table_base(&pdev->dev, &phb->p5ioc2.iommu_table); set_iommu_table_base(&pdev->dev, &phb->p5ioc2.iommu_table);
} }
static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
void *tce_mem, u64 tce_size) void *tce_mem, u64 tce_size)
{ {
struct pnv_phb *phb; struct pnv_phb *phb;
...@@ -136,6 +136,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, ...@@ -136,6 +136,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np,
phb->hose->first_busno = 0; phb->hose->first_busno = 0;
phb->hose->last_busno = 0xff; phb->hose->last_busno = 0xff;
phb->hose->private_data = phb; phb->hose->private_data = phb;
phb->hub_id = hub_id;
phb->opal_id = phb_id; phb->opal_id = phb_id;
phb->type = PNV_PHB_P5IOC2; phb->type = PNV_PHB_P5IOC2;
phb->model = PNV_PHB_MODEL_P5IOC2; phb->model = PNV_PHB_MODEL_P5IOC2;
...@@ -229,7 +230,8 @@ void __init pnv_pci_init_p5ioc2_hub(struct device_node *np) ...@@ -229,7 +230,8 @@ void __init pnv_pci_init_p5ioc2_hub(struct device_node *np)
for_each_child_of_node(np, phbn) { for_each_child_of_node(np, phbn) {
if (of_device_is_compatible(phbn, "ibm,p5ioc2-pcix") || if (of_device_is_compatible(phbn, "ibm,p5ioc2-pcix") ||
of_device_is_compatible(phbn, "ibm,p5ioc2-pciex")) { of_device_is_compatible(phbn, "ibm,p5ioc2-pciex")) {
pnv_pci_init_p5ioc2_phb(phbn, tce_mem, tce_per_phb); pnv_pci_init_p5ioc2_phb(phbn, hub_id,
tce_mem, tce_per_phb);
tce_mem += tce_per_phb; tce_mem += tce_per_phb;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment