Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
---
- arch/powerpc/platforms/pseries/msi.c | 40 ++++++++++++++++++++++++++++++++---
- 1 file changed, 37 insertions(+), 3 deletions(-)
+ arch/powerpc/platforms/pseries/msi.c | 42 ++++++++++++++++++++++++++++++++---
+ 1 file changed, 39 insertions(+), 3 deletions(-)
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
-@@ -394,6 +394,23 @@ static int check_msix_entries(struct pci
+@@ -394,6 +394,25 @@ static int check_msix_entries(struct pci
return 0;
}
+static void rtas_hack_32bit_msi_gen2(struct pci_dev *pdev)
+{
+ u32 addr_hi, addr_lo;
++ int pos;
+
+ /*
+ * We should only get in here for IODA1 configs. This is based on the
+ */
+ dev_info(&pdev->dev,
+ "rtas_msi: No 32 bit MSI firmware support, forcing 32 bit MSI\n");
-+ pci_read_config_dword(pdev, pdev->msi_cap + PCI_MSI_ADDRESS_HI, &addr_hi);
++ pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
++ pci_read_config_dword(pdev, pos + PCI_MSI_ADDRESS_HI, &addr_hi);
+ addr_lo = 0xffff0000 | ((addr_hi >> (48 - 32)) << 4);
-+ pci_write_config_dword(pdev, pdev->msi_cap + PCI_MSI_ADDRESS_LO, addr_lo);
-+ pci_write_config_dword(pdev, pdev->msi_cap + PCI_MSI_ADDRESS_HI, 0);
++ pci_write_config_dword(pdev, pos + PCI_MSI_ADDRESS_LO, addr_lo);
++ pci_write_config_dword(pdev, pos + PCI_MSI_ADDRESS_HI, 0);
+}
+
static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
{
struct pci_dn *pdn;
-@@ -401,6 +418,7 @@ static int rtas_setup_msi_irqs(struct pc
+@@ -401,6 +420,7 @@ static int rtas_setup_msi_irqs(struct pc
struct msi_desc *entry;
struct msi_msg msg;
int nvec = nvec_in;
pdn = get_pdn(pdev);
if (!pdn)
-@@ -428,15 +446,31 @@ static int rtas_setup_msi_irqs(struct pc
+@@ -428,15 +448,31 @@ static int rtas_setup_msi_irqs(struct pc
*/
again:
if (type == PCI_CAP_ID_MSI) {