IB/mthca: Fix driver when sizeof (phys_addr_t) > sizeof (long)

Some systems have PCI addresses that don't fit in unsigned long (eg some
32-bit PowerPC 440 systems have 36-bit bus addresses). Fix up the driver
by using phys_addr_t where appropriate, so we don't truncate any PCI
resource addresses before ioremapping them.

Signed-off-by: John L. Burr <jlburr@cadence.com>

[ Update to apply to current driver source. - Roland ]

Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by John L. Burr and committed by Roland Dreier eb4a7cbf 4162cf64

+7 -6
+3 -2
drivers/infiniband/hw/mthca/mthca_catas.c
··· 146 146 147 147 void mthca_start_catas_poll(struct mthca_dev *dev) 148 148 { 149 - unsigned long addr; 149 + phys_addr_t addr; 150 150 151 151 init_timer(&dev->catas_err.timer); 152 152 dev->catas_err.map = NULL; ··· 158 158 dev->catas_err.map = ioremap(addr, dev->catas_err.size * 4); 159 159 if (!dev->catas_err.map) { 160 160 mthca_warn(dev, "couldn't map catastrophic error region " 161 - "at 0x%lx/0x%x\n", addr, dev->catas_err.size * 4); 161 + "at 0x%llx/0x%x\n", (unsigned long long) addr, 162 + dev->catas_err.size * 4); 162 163 return; 163 164 } 164 165
+1 -1
drivers/infiniband/hw/mthca/mthca_cmd.c
··· 713 713 714 714 static void mthca_setup_cmd_doorbells(struct mthca_dev *dev, u64 base) 715 715 { 716 - unsigned long addr; 716 + phys_addr_t addr; 717 717 u16 max_off = 0; 718 718 int i; 719 719
+1 -1
drivers/infiniband/hw/mthca/mthca_eq.c
··· 653 653 unsigned long offset, unsigned long size, 654 654 void __iomem **map) 655 655 { 656 - unsigned long base = pci_resource_start(dev->pdev, 0); 656 + phys_addr_t base = pci_resource_start(dev->pdev, 0); 657 657 658 658 *map = ioremap(base + offset, size); 659 659 if (!*map)
+1 -1
drivers/infiniband/hw/mthca/mthca_main.c
··· 790 790 goto err_uar_table_free; 791 791 } 792 792 793 - dev->kar = ioremap(dev->driver_uar.pfn << PAGE_SHIFT, PAGE_SIZE); 793 + dev->kar = ioremap((phys_addr_t) dev->driver_uar.pfn << PAGE_SHIFT, PAGE_SIZE); 794 794 if (!dev->kar) { 795 795 mthca_err(dev, "Couldn't map kernel access region, " 796 796 "aborting.\n");
+1 -1
drivers/infiniband/hw/mthca/mthca_mr.c
··· 853 853 854 854 int mthca_init_mr_table(struct mthca_dev *dev) 855 855 { 856 - unsigned long addr; 856 + phys_addr_t addr; 857 857 int mpts, mtts, err, i; 858 858 859 859 err = mthca_alloc_init(&dev->mr_table.mpt_alloc,