aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv/pci-ioda.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci-ioda.c')
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 3937aaae5bc4..9c9d15e4cdf2 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -68,16 +68,6 @@ define_pe_printk_level(pe_err, KERN_ERR);
68define_pe_printk_level(pe_warn, KERN_WARNING); 68define_pe_printk_level(pe_warn, KERN_WARNING);
69define_pe_printk_level(pe_info, KERN_INFO); 69define_pe_printk_level(pe_info, KERN_INFO);
70 70
71static struct pci_dn *pnv_ioda_get_pdn(struct pci_dev *dev)
72{
73 struct device_node *np;
74
75 np = pci_device_to_OF_node(dev);
76 if (!np)
77 return NULL;
78 return PCI_DN(np);
79}
80
81static int pnv_ioda_alloc_pe(struct pnv_phb *phb) 71static int pnv_ioda_alloc_pe(struct pnv_phb *phb)
82{ 72{
83 unsigned long pe; 73 unsigned long pe;
@@ -110,7 +100,7 @@ static struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev)
110{ 100{
111 struct pci_controller *hose = pci_bus_to_host(dev->bus); 101 struct pci_controller *hose = pci_bus_to_host(dev->bus);
112 struct pnv_phb *phb = hose->private_data; 102 struct pnv_phb *phb = hose->private_data;
113 struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 103 struct pci_dn *pdn = pci_get_pdn(dev);
114 104
115 if (!pdn) 105 if (!pdn)
116 return NULL; 106 return NULL;
@@ -173,7 +163,7 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
173 163
174 /* Add to all parents PELT-V */ 164 /* Add to all parents PELT-V */
175 while (parent) { 165 while (parent) {
176 struct pci_dn *pdn = pnv_ioda_get_pdn(parent); 166 struct pci_dn *pdn = pci_get_pdn(parent);
177 if (pdn && pdn->pe_number != IODA_INVALID_PE) { 167 if (pdn && pdn->pe_number != IODA_INVALID_PE) {
178 rc = opal_pci_set_peltv(phb->opal_id, pdn->pe_number, 168 rc = opal_pci_set_peltv(phb->opal_id, pdn->pe_number,
179 pe->pe_number, OPAL_ADD_PE_TO_DOMAIN); 169 pe->pe_number, OPAL_ADD_PE_TO_DOMAIN);
@@ -252,7 +242,7 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)
252{ 242{
253 struct pci_controller *hose = pci_bus_to_host(dev->bus); 243 struct pci_controller *hose = pci_bus_to_host(dev->bus);
254 struct pnv_phb *phb = hose->private_data; 244 struct pnv_phb *phb = hose->private_data;
255 struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 245 struct pci_dn *pdn = pci_get_pdn(dev);
256 struct pnv_ioda_pe *pe; 246 struct pnv_ioda_pe *pe;
257 int pe_num; 247 int pe_num;
258 248
@@ -323,7 +313,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
323 struct pci_dev *dev; 313 struct pci_dev *dev;
324 314
325 list_for_each_entry(dev, &bus->devices, bus_list) { 315 list_for_each_entry(dev, &bus->devices, bus_list) {
326 struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 316 struct pci_dn *pdn = pci_get_pdn(dev);
327 317
328 if (pdn == NULL) { 318 if (pdn == NULL) {
329 pr_warn("%s: No device node associated with device !\n", 319 pr_warn("%s: No device node associated with device !\n",
@@ -436,7 +426,7 @@ static void pnv_pci_ioda_setup_PEs(void)
436 426
437static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev) 427static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev)
438{ 428{
439 struct pci_dn *pdn = pnv_ioda_get_pdn(pdev); 429 struct pci_dn *pdn = pci_get_pdn(pdev);
440 struct pnv_ioda_pe *pe; 430 struct pnv_ioda_pe *pe;
441 431
442 /* 432 /*
@@ -768,6 +758,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
768 unsigned int is_64, struct msi_msg *msg) 758 unsigned int is_64, struct msi_msg *msg)
769{ 759{
770 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); 760 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev);
761 struct pci_dn *pdn = pci_get_pdn(dev);
771 struct irq_data *idata; 762 struct irq_data *idata;
772 struct irq_chip *ichip; 763 struct irq_chip *ichip;
773 unsigned int xive_num = hwirq - phb->msi_base; 764 unsigned int xive_num = hwirq - phb->msi_base;
@@ -783,6 +774,10 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
783 if (pe->mve_number < 0) 774 if (pe->mve_number < 0)
784 return -ENXIO; 775 return -ENXIO;
785 776
777 /* Force 32-bit MSI on some broken devices */
778 if (pdn && pdn->force_32bit_msi)
779 is_64 = 0;
780
786 /* Assign XIVE to PE */ 781 /* Assign XIVE to PE */
787 rc = opal_pci_set_xive_pe(phb->opal_id, pe->pe_number, xive_num); 782 rc = opal_pci_set_xive_pe(phb->opal_id, pe->pe_number, xive_num);
788 if (rc) { 783 if (rc) {
@@ -1035,7 +1030,7 @@ static int pnv_pci_enable_device_hook(struct pci_dev *dev)
1035 if (!phb->initialized) 1030 if (!phb->initialized)
1036 return 0; 1031 return 0;
1037 1032
1038 pdn = pnv_ioda_get_pdn(dev); 1033 pdn = pci_get_pdn(dev);
1039 if (!pdn || pdn->pe_number == IODA_INVALID_PE) 1034 if (!pdn || pdn->pe_number == IODA_INVALID_PE)
1040 return -EINVAL; 1035 return -EINVAL;
1041 1036