Commit d883f7f1 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Dave Airlie

drm: Use resource_size_t for drm_get_resource_{start, len}

The DRM uses its own wrappers to obtain resources from PCI devices,
which currently convert the resource_size_t into an unsigned long.

This is broken on 32-bit platforms with >32-bit physical address
space.

This fixes them, along with a few occurences of unsigned long used
to store such a resource in drivers.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 041b6237
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include "drmP.h" #include "drmP.h"
unsigned long drm_get_resource_start(struct drm_device *dev, unsigned int resource) resource_size_t drm_get_resource_start(struct drm_device *dev, unsigned int resource)
{ {
return pci_resource_start(dev->pdev, resource); return pci_resource_start(dev->pdev, resource);
} }
EXPORT_SYMBOL(drm_get_resource_start); EXPORT_SYMBOL(drm_get_resource_start);
unsigned long drm_get_resource_len(struct drm_device *dev, unsigned int resource) resource_size_t drm_get_resource_len(struct drm_device *dev, unsigned int resource)
{ {
return pci_resource_len(dev->pdev, resource); return pci_resource_len(dev->pdev, resource);
} }
......
...@@ -1057,7 +1057,7 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master) ...@@ -1057,7 +1057,7 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master)
int i915_driver_load(struct drm_device *dev, unsigned long flags) int i915_driver_load(struct drm_device *dev, unsigned long flags)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long base, size; resource_size_t base, size;
int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1;
/* i915 has 4 more counters */ /* i915 has 4 more counters */
......
...@@ -113,8 +113,8 @@ typedef struct drm_mga_private { ...@@ -113,8 +113,8 @@ typedef struct drm_mga_private {
* \sa drm_mga_private_t::mmio * \sa drm_mga_private_t::mmio
*/ */
/*@{ */ /*@{ */
u32 mmio_base; /**< Bus address of base of MMIO. */ resource_size_t mmio_base; /**< Bus address of base of MMIO. */
u32 mmio_size; /**< Size of the MMIO region. */ resource_size_t mmio_size; /**< Size of the MMIO region. */
/*@} */ /*@} */
u32 clear_cmd; u32 clear_cmd;
......
...@@ -316,7 +316,7 @@ typedef struct drm_radeon_private { ...@@ -316,7 +316,7 @@ typedef struct drm_radeon_private {
/* starting from here on, data is preserved accross an open */ /* starting from here on, data is preserved accross an open */
uint32_t flags; /* see radeon_chip_flags */ uint32_t flags; /* see radeon_chip_flags */
unsigned long fb_aper_offset; resource_size_t fb_aper_offset;
int num_gb_pipes; int num_gb_pipes;
int track_flush; int track_flush;
......
...@@ -599,8 +599,8 @@ int savage_driver_firstopen(struct drm_device *dev) ...@@ -599,8 +599,8 @@ int savage_driver_firstopen(struct drm_device *dev)
drm_mtrr_add(dev_priv->mtrr[2].base, drm_mtrr_add(dev_priv->mtrr[2].base,
dev_priv->mtrr[2].size, DRM_MTRR_WC); dev_priv->mtrr[2].size, DRM_MTRR_WC);
} else { } else {
DRM_ERROR("strange pci_resource_len %08lx\n", DRM_ERROR("strange pci_resource_len %08llx\n",
drm_get_resource_len(dev, 0)); (unsigned long long)drm_get_resource_len(dev, 0));
} }
} else if (dev_priv->chipset != S3_SUPERSAVAGE && } else if (dev_priv->chipset != S3_SUPERSAVAGE &&
dev_priv->chipset != S3_SAVAGE2000) { dev_priv->chipset != S3_SAVAGE2000) {
...@@ -620,8 +620,8 @@ int savage_driver_firstopen(struct drm_device *dev) ...@@ -620,8 +620,8 @@ int savage_driver_firstopen(struct drm_device *dev)
drm_mtrr_add(dev_priv->mtrr[0].base, drm_mtrr_add(dev_priv->mtrr[0].base,
dev_priv->mtrr[0].size, DRM_MTRR_WC); dev_priv->mtrr[0].size, DRM_MTRR_WC);
} else { } else {
DRM_ERROR("strange pci_resource_len %08lx\n", DRM_ERROR("strange pci_resource_len %08llx\n",
drm_get_resource_len(dev, 1)); (unsigned long long)drm_get_resource_len(dev, 1));
} }
} else { } else {
mmio_base = drm_get_resource_start(dev, 0); mmio_base = drm_get_resource_start(dev, 0);
......
...@@ -1173,10 +1173,10 @@ extern int drm_freebufs(struct drm_device *dev, void *data, ...@@ -1173,10 +1173,10 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
extern int drm_mapbufs(struct drm_device *dev, void *data, extern int drm_mapbufs(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern int drm_order(unsigned long size); extern int drm_order(unsigned long size);
extern unsigned long drm_get_resource_start(struct drm_device *dev, extern resource_size_t drm_get_resource_start(struct drm_device *dev,
unsigned int resource);
extern resource_size_t drm_get_resource_len(struct drm_device *dev,
unsigned int resource); unsigned int resource);
extern unsigned long drm_get_resource_len(struct drm_device *dev,
unsigned int resource);
/* DMA support (drm_dma.h) */ /* DMA support (drm_dma.h) */
extern int drm_dma_setup(struct drm_device *dev); extern int drm_dma_setup(struct drm_device *dev);
......
...@@ -550,7 +550,7 @@ struct drm_mode_config { ...@@ -550,7 +550,7 @@ struct drm_mode_config {
int min_width, min_height; int min_width, min_height;
int max_width, max_height; int max_width, max_height;
struct drm_mode_config_funcs *funcs; struct drm_mode_config_funcs *funcs;
unsigned long fb_base; resource_size_t fb_base;
/* pointers to standard properties */ /* pointers to standard properties */
struct list_head property_blob_list; struct list_head property_blob_list;
......
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