]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mlx4_{core, ib, en}: Fix driver when sizeof (phys_addr_t) > sizeof (long)
authorRoland Dreier <rolandd@cisco.com>
Wed, 12 Jan 2011 17:50:36 +0000 (09:50 -0800)
committerRoland Dreier <rolandd@cisco.com>
Wed, 12 Jan 2011 17:50:36 +0000 (09:50 -0800)
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 mlx4 drivers
by using phys_addr_t where appropriate, so we don't truncate any PCI
resource addresses before ioremapping them.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mlx4/main.c
drivers/net/mlx4/catas.c
drivers/net/mlx4/en_main.c
drivers/net/mlx4/main.c

index 4c85224aeaa7ac91f230e3acf286420e3034b886..d68d849ab866e9041beb907b287084bdf7cabc74 100644 (file)
@@ -1005,7 +1005,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
        if (mlx4_uar_alloc(dev, &ibdev->priv_uar))
                goto err_pd;
 
-       ibdev->uar_map = ioremap(ibdev->priv_uar.pfn << PAGE_SHIFT, PAGE_SIZE);
+       ibdev->uar_map = ioremap((phys_addr_t) ibdev->priv_uar.pfn << PAGE_SHIFT,
+                                PAGE_SIZE);
        if (!ibdev->uar_map)
                goto err_uar;
        MLX4_INIT_DOORBELL_LOCK(&ibdev->uar_lock);
index 68aaa42d0ced7b1f93771cacce3ca5abeec786db..32f947154c33c1f7acddb015972cb312878e9ecd 100644 (file)
@@ -113,7 +113,7 @@ static void catas_reset(struct work_struct *work)
 void mlx4_start_catas_poll(struct mlx4_dev *dev)
 {
        struct mlx4_priv *priv = mlx4_priv(dev);
-       unsigned long addr;
+       phys_addr_t addr;
 
        INIT_LIST_HEAD(&priv->catas_err.list);
        init_timer(&priv->catas_err.timer);
@@ -124,8 +124,8 @@ void mlx4_start_catas_poll(struct mlx4_dev *dev)
 
        priv->catas_err.map = ioremap(addr, priv->fw.catas_size * 4);
        if (!priv->catas_err.map) {
-               mlx4_warn(dev, "Failed to map internal error buffer at 0x%lx\n",
-                         addr);
+               mlx4_warn(dev, "Failed to map internal error buffer at 0x%llx\n",
+                         (unsigned long long) addr);
                return;
        }
 
index f6e0d40cd876407ddf998ff846cf095cfaeddd4f..1ff6ca6466ed1de709c68ff53210a556b5f406b1 100644 (file)
@@ -202,7 +202,8 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
        if (mlx4_uar_alloc(dev, &mdev->priv_uar))
                goto err_pd;
 
-       mdev->uar_map = ioremap(mdev->priv_uar.pfn << PAGE_SHIFT, PAGE_SIZE);
+       mdev->uar_map = ioremap((phys_addr_t) mdev->priv_uar.pfn << PAGE_SHIFT,
+                               PAGE_SIZE);
        if (!mdev->uar_map)
                goto err_uar;
        spin_lock_init(&mdev->uar_lock);
index 782f11d8fa71d52e2ae8549c41970c52cdb2cbb8..4ffdc18fcb8a5fc0d2219b697ad5dc03e7975191 100644 (file)
@@ -829,7 +829,7 @@ static int mlx4_setup_hca(struct mlx4_dev *dev)
                goto err_uar_table_free;
        }
 
-       priv->kar = ioremap(priv->driver_uar.pfn << PAGE_SHIFT, PAGE_SIZE);
+       priv->kar = ioremap((phys_addr_t) priv->driver_uar.pfn << PAGE_SHIFT, PAGE_SIZE);
        if (!priv->kar) {
                mlx4_err(dev, "Couldn't map kernel access region, "
                         "aborting.\n");